diff options
author | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-17 15:34:32 +0000 |
---|---|---|
committer | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-17 15:34:32 +0000 |
commit | 58f41c8128e21e4bde685c08d0bdf733dbf9147d (patch) | |
tree | 389f0c9bcbef7e86d836cf0b0a0923da46ad053d | |
parent | 1d7feb8ebbf9bc570136ade67b7413610be5987e (diff) | |
download | chromium_src-58f41c8128e21e4bde685c08d0bdf733dbf9147d.zip chromium_src-58f41c8128e21e4bde685c08d0bdf733dbf9147d.tar.gz chromium_src-58f41c8128e21e4bde685c08d0bdf733dbf9147d.tar.bz2 |
UMA statistics for enabling/disabling synced notification sending services.
For Synced Notifications, we wish to measure how often users turn off
notifications, both in general and for particular sending services.
Due to a limitation in the way that histograms are collected, we an only
collect enum style data. So, I have chosen to manually represent the first
several sending services. This obviously doesn't scale as we add more
sending services, so my intent is to add several more, then see if the data
we are getting is still interesting, and perhaps remove the "per-service"
histogram data by the time we have a good set of data.
BUG=280251
Review URL: https://codereview.chromium.org/27267002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229141 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 75 insertions, 1 deletions
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc index 939c2d4..3118a9e 100644 --- a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc +++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc @@ -12,6 +12,7 @@ #include <vector> #include "base/command_line.h" +#include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" #include "base/values.h" #include "chrome/browser/notifications/desktop_notification_service.h" @@ -23,6 +24,7 @@ #include "chrome/common/pref_names.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/user_metrics.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "sync/api/sync_change.h" @@ -36,6 +38,8 @@ #include "ui/message_center/notifier_settings.h" #include "url/gurl.h" +using content::UserMetricsAction; + namespace notifier { const char kFirstSyncedNotificationServiceId[] = "Google+"; @@ -493,10 +497,46 @@ void ChromeNotifierService::OnSyncedNotificationServiceEnabled( RemoveUnreadNotificationsFromSource(notifier_id_copy); } - // Otherwise, nothing to do, we can exit. + // Collect UMA statistics when a service is enabled or disabled. + if (enabled) { + content::RecordAction( + UserMetricsAction("SyncedNotifications.SendingServiceEnabled")); + } else { + content::RecordAction( + UserMetricsAction("SyncedNotifications.SendingServiceDisabled")); + } + + // Collect individual service enabling/disabling statistics. + CollectPerServiceEnablingStatistics(notifier_id, enabled); + return; } +void ChromeNotifierService::CollectPerServiceEnablingStatistics( + const std::string& notifier_id, + bool enabled) { + // TODO(petewil) - This approach does not scale well as we add new services, + // but we are limited to using predefined ENUM values in histogram based UMA + // data, which does not permit arbitrary strings. + // Find a way to make it scale, or remove enum value this when we have enough + // data. + + ChromeNotifierServiceActionType action = + CHROME_NOTIFIER_SERVICE_ACTION_UNKNOWN; + + // Derive action type from notifier_id and enabled. + // TODO(petewil): Add more sending services as they are enabled. + if (notifier_id == std::string(kFirstSyncedNotificationServiceId)) { + action = enabled + ? CHROME_NOTIFIER_SERVICE_ACTION_FIRST_SERVICE_ENABLED + : CHROME_NOTIFIER_SERVICE_ACTION_FIRST_SERVICE_DISABLED; + } + + UMA_HISTOGRAM_ENUMERATION("ChromeNotifierService.Actions", + action, + CHROME_NOTIFIER_SERVICE_ACTION_COUNT); +} + void ChromeNotifierService::BuildServiceListValueInplace( std::set<std::string> services, base::ListValue* list_value) { std::set<std::string>::iterator iter; @@ -616,6 +656,7 @@ void ChromeNotifierService::InitializePrefs() { // Get the prefs from last session into our memeber varilables OnEnabledSendingServiceListPrefChanged(&enabled_sending_services_); OnInitializedSendingServiceListPrefChanged(&initialized_sending_services_); + synced_notification_first_run_ = profile_->GetPrefs()->GetBoolean(prefs::kSyncedNotificationFirstRun); } diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h index 787fcbd..356448f 100644 --- a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h +++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.h @@ -32,6 +32,16 @@ extern const char kFirstSyncedNotificationServiceId[]; extern const char kServiceEnabledOnce[]; extern const char kSyncedNotificationFirstRun[]; +enum ChromeNotifierServiceActionType { + CHROME_NOTIFIER_SERVICE_ACTION_UNKNOWN, + CHROME_NOTIFIER_SERVICE_ACTION_FIRST_SERVICE_ENABLED, + CHROME_NOTIFIER_SERVICE_ACTION_FIRST_SERVICE_DISABLED, + // NOTE: Add new action types only immediately above this line. Also, + // make sure the enum list in tools/histogram/histograms.xml is + // updated with any change in here. + CHROME_NOTIFIER_SERVICE_ACTION_COUNT +}; + // The ChromeNotifierService holds notifications which represent the state of // delivered notifications for chrome. These are obtained from the sync service // and kept up to date. @@ -123,6 +133,11 @@ class ChromeNotifierService : public syncer::SyncableService, // for that service, and remove them from the message center. void RemoveUnreadNotificationsFromSource(const std::string& notifier_id); + // When we turn a sending service on or off, collect statistics about + // how often users turn it on or off. + void CollectPerServiceEnablingStatistics(const std::string& notifier_id, + bool enabled); + // When we start up or hear of a new service, turn it on by default. void AddNewSendingServices(); diff --git a/tools/metrics/actions/chromeactions.txt b/tools/metrics/actions/chromeactions.txt index e887268..760b59d 100644 --- a/tools/metrics/actions/chromeactions.txt +++ b/tools/metrics/actions/chromeactions.txt @@ -446,6 +446,7 @@ 0xb685d7994214aa1f ForwardMenu_HistoryClick9 0xb8ea5cd4ac9a7a71 ForwardMenu_Popup 0x87bdcab6bfd481db ForwardMenu_ShowFullHistory +0x78646175083b9abe Gesture_Overview 0x5f075ae3e1f9d038 Go 0xab2334cdb766e7c7 GoogleNow.ButtonClicked0 0xc06f4ecf7cf01b27 GoogleNow.ButtonClicked1 @@ -1570,6 +1571,8 @@ 0x2fbe99005588ef01 StartupTick 0x11a755d598c0c417 Stop 0x926a51baad949d12 Strikethrough +0x197787e3bdf50f03 SyncedNotifications.SendingServiceDisabled +0xb789d5822bf411fe SyncedNotifications.SendingServiceEnabled 0xc3100ff8c8a00184 SystemBack 0x4c211ce58592c3e6 SystemBackForNavigation 0x4d56afb0a9837d41 TabContextMenu_BookmarkAllTabs diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 6d73bb4..3d8917c 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -1335,6 +1335,15 @@ other types of suffix sets. </summary> </histogram> +<histogram name="ChromeNotifierService.Actions" + enum="ChromeNotifierServiceActionType"> + <summary> + The actions to enable or disable services sending synced notifications. + Synced Notification Sending services can be individually disabled by the + user in the Chrome Notification center settings dialog. + </summary> +</histogram> + <histogram name="clickjacking.discard_download" units="ms"> <summary> The length of time between a dangerous download appearing on the downloads @@ -20128,6 +20137,12 @@ other types of suffix sets. <int value="4" label="Initiated by Plugin Installer"/> </enum> +<enum name="ChromeNotifierServiceActionType" type="int"> + <int value="0" label="Unknown"/> + <int value="1" label="First service enabled"/> + <int value="2" label="First service disabled"/> +</enum> + <enum name="ChromeOSUserImageId" type="int"> <summary> Indices of the default images as defined in |