summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpetewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-21 01:20:37 +0000
committerpetewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-21 01:20:37 +0000
commit1f978dcd9d2434579af36bb58519af3a9e84e7cc (patch)
treeebc90a65532d781c5fdf9d3674ecb53dd14b5f98
parenta4124e01efef815e5f0cb927b5e1433e771f0906 (diff)
downloadchromium_src-1f978dcd9d2434579af36bb58519af3a9e84e7cc.zip
chromium_src-1f978dcd9d2434579af36bb58519af3a9e84e7cc.tar.gz
chromium_src-1f978dcd9d2434579af36bb58519af3a9e84e7cc.tar.bz2
Add UMA histogram data representing the Synced Notifications feature.
1. First, I added a new data point for muting and unmuting the notification system. 2. Second, I added a new histogram for Synced Notifications that measures common events that happen with them. 3. In a follow up chekin, I will also measure how often individual synced notification services are turned off. BUG=280251 Review URL: https://codereview.chromium.org/26943002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229720 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/notifications/message_center_stats_collector.cc7
-rw-r--r--chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc22
-rw-r--r--chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h16
-rw-r--r--tools/metrics/actions/chromeactions.txt2
-rw-r--r--tools/metrics/histograms/histograms.xml26
5 files changed, 68 insertions, 5 deletions
diff --git a/chrome/browser/notifications/message_center_stats_collector.cc b/chrome/browser/notifications/message_center_stats_collector.cc
index f0257a9..3279728 100644
--- a/chrome/browser/notifications/message_center_stats_collector.cc
+++ b/chrome/browser/notifications/message_center_stats_collector.cc
@@ -134,5 +134,12 @@ void MessageCenterStatsCollector::OnCenterVisibilityChanged(
}
void MessageCenterStatsCollector::OnQuietModeChanged(bool in_quiet_mode) {
+ if (in_quiet_mode) {
+ content::RecordAction(
+ content::UserMetricsAction("Notifications.Mute"));
+ } else {
+ content::RecordAction(
+ content::UserMetricsAction("Notifications.Unmute"));
+ }
}
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
index 96f74c9..9585d81 100644
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
@@ -4,11 +4,14 @@
#include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h"
+
+#include "base/metrics/histogram.h"
#include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
#include "chrome/browser/notifications/sync_notifier/synced_notification.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/page_navigator.h"
+#include "content/public/browser/user_metrics.h"
namespace notifier {
ChromeNotifierDelegate::ChromeNotifierDelegate(
@@ -26,6 +29,15 @@ content::RenderViewHost* ChromeNotifierDelegate::GetRenderViewHost() const {
return NULL;
}
+void ChromeNotifierDelegate::CollectAction(SyncedNotificationActionType type) {
+ DCHECK(!notification_id_.empty());
+
+ UMA_HISTOGRAM_ENUMERATION("SyncedNotifications.Actions",
+ type,
+ SYNCED_NOTIFICATION_ACTION_COUNT);
+}
+
+
// TODO(petewil) Add the ability to do URL actions also.
void ChromeNotifierDelegate::Click() {
SyncedNotification* notification =
@@ -36,6 +48,9 @@ void ChromeNotifierDelegate::Click() {
GURL destination = notification->GetDefaultDestinationUrl();
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ // Record the action in UMA statistics.
+ CollectAction(SYNCED_NOTIFICATION_ACTION_CLICK);
}
// TODO(petewil) Add the ability to do URL actions also.
@@ -47,6 +62,9 @@ void ChromeNotifierDelegate::ButtonClick(int button_index) {
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
}
+
+ // Now record the UMA statistics for this action.
+ CollectAction(SYNCED_NOTIFICATION_ACTION_BUTTON_CLICK);
}
void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
@@ -68,6 +86,10 @@ void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
void ChromeNotifierDelegate::Close(bool by_user) {
if (by_user)
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ CollectAction(by_user ?
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_USER :
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_SYSTEM);
}
} // namespace notifier
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h
index f0ea79b..4bf75fe 100644
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H_
#define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H_
+#include <map>
#include <string>
#include "chrome/browser/notifications/notification_delegate.h"
@@ -12,6 +13,19 @@
namespace notifier {
+enum SyncedNotificationActionType {
+ SYNCED_NOTIFICATION_ACTION_UNKNOWN,
+ SYNCED_NOTIFICATION_ACTION_CLICK,
+ SYNCED_NOTIFICATION_ACTION_BUTTON_CLICK,
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_USER,
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_SYSTEM,
+ SYNCED_NOTIFICATION_ACTION_TOAST_TIMEOUT,
+ // 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.
+ SYNCED_NOTIFICATION_ACTION_COUNT
+};
+
class ChromeNotifierService;
// ChromeNotifierDelegate is a NotificationDelegate which catches
@@ -35,6 +49,8 @@ class ChromeNotifierDelegate : public NotificationDelegate {
virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE;
+ void CollectAction(SyncedNotificationActionType type);
+
private:
virtual ~ChromeNotifierDelegate();
void NavigateToUrl(const GURL& destination) const;
diff --git a/tools/metrics/actions/chromeactions.txt b/tools/metrics/actions/chromeactions.txt
index 1b0ba12..16d66e0 100644
--- a/tools/metrics/actions/chromeactions.txt
+++ b/tools/metrics/actions/chromeactions.txt
@@ -1217,8 +1217,10 @@
0x95c990454684cb1d NewTabPage_ReopenTab
0xab4d417c5ca44904 NewTab_Button
0xbdc9ec125e7a3ade NewWindow
+0x56e2be5803efccc1 Notifications.Mute
0xa86d43452b05bf72 Notifications.ShowMessageCenter
0x9a102e132f96503f Notifications.ShowSettings
+0xd2175e238a75b56a Notifications.Unmute
0xa72c673a1f44d11f OmniboxDestinationURLIsSearchOnDSP
0x6048dbd4f2f2ca50 OmniboxDestinationURLMatchesDefaultSearchProvider
0x268376698078c71b OmniboxInputInProgress
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 03c3daa..d9955f1 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -8376,10 +8376,9 @@ other types of suffix sets.
</summary>
</histogram>
-<histogram name="Net.QuicSession.NumTotalStreams">
+<histogram name="Net.QuicSession.FinalTcpCwnd">
<summary>
- The total number of streams created by the client when the session is
- closed.
+ The value of the TCP cubic sender's CWND when the session is closed.
</summary>
</histogram>
@@ -8389,9 +8388,10 @@ other types of suffix sets.
</summary>
</histogram>
-<histogram name="Net.QuicSession.FinalTcpCwnd">
+<histogram name="Net.QuicSession.NumTotalStreams">
<summary>
- The value of the TCP cubic sender's CWND when the session is closed.
+ The total number of streams created by the client when the session is
+ closed.
</summary>
</histogram>
@@ -17918,6 +17918,14 @@ other types of suffix sets.
</summary>
</histogram>
+<histogram name="SyncedNotification.Actions"
+ enum="SyncedNotificationActionType">
+ <summary>
+ The actions taken on synced notifications, recorded every time they happen.
+ This histogram will record every single event that happens separately.
+ </summary>
+</histogram>
+
<histogram name="Tab.AgeUponRestoreFromColdStart" units="minutes">
<summary>
Age (time since the last display in previous sessions) of a tab being
@@ -27310,6 +27318,14 @@ other types of suffix sets.
<int value="3" label="Attempted"/>
</enum>
+<enum name="SyncedNotificationActionType" type="int">
+ <int value="0" label="Unknown"/>
+ <int value="1" label="Notification clicked"/>
+ <int value="2" label="Notification button clicked"/>
+ <int value="3" label="Notification closed by user"/>
+ <int value="4" label="Notification closed by system"/>
+</enum>
+
<enum name="TabRestoreResult" type="int">
<int value="0" label="Failure (other)"/>
<int value="1" label="Success"/>