Bug 971171 - Measure with telemetry how many times people see about:newtab. r=ttaubert, r=bsmedberg, a=sledru
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 14 Feb 2014 12:00:49 +0100
changeset 182888 e18e57eeb6b7c87cca6fb8ce70aca1f1ba655f9c
parent 182887 69a772ab5bcbf8c8b65a2af3349007d8aa47fdb7
child 182889 f24272656ba229d2ae468a8e8b73d8c94fe45f83
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert, bsmedberg, sledru
bugs971171
milestone29.0a2
Bug 971171 - Measure with telemetry how many times people see about:newtab. r=ttaubert, r=bsmedberg, a=sledru
browser/base/content/browser.js
browser/base/content/newtab/page.js
toolkit/components/telemetry/Histograms.json
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -996,18 +996,23 @@ var gBrowserInit = {
       //                 [4]: allowThirdPartyFixup (bool)
       else if (window.arguments.length >= 3) {
         loadURI(uriToLoad, window.arguments[2], window.arguments[3] || null,
                 window.arguments[4] || false);
         window.focus();
       }
       // Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
       // Such callers expect that window.arguments[0] is handled as a single URI.
-      else
+      else {
+        if (uriToLoad == "about:newtab" &&
+            Services.prefs.getBoolPref("browser.newtabpage.enabled")) {
+          Services.telemetry.getHistogramById("NEWTAB_PAGE_SHOWN").add(true);
+        }
         loadOneOrMoreURIs(uriToLoad);
+      }
     }
 
 #ifdef MOZ_SAFE_BROWSING
     // Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
     setTimeout(function() { SafeBrowsing.init(); }, 2000);
 #endif
 
     Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
--- a/browser/base/content/newtab/page.js
+++ b/browser/base/content/newtab/page.js
@@ -80,16 +80,18 @@ let gPage = {
   _init: function Page_init() {
     if (this._initialized)
       return;
 
     this._initialized = true;
 
     this._mutationObserver = new MutationObserver(() => {
       if (this.allowBackgroundCaptures) {
+        Services.telemetry.getHistogramById("NEWTAB_PAGE_SHOWN").add(true);
+
         for (let site of gGrid.sites) {
           if (site) {
             site.captureIfMissing();
           }
         }
       }
     });
     this._mutationObserver.observe(document.documentElement, {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3985,16 +3985,21 @@
   "NEWTAB_PAGE_BLOCKED_SITES_COUNT": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "100",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Number of sites blocked from the new tab page."
   },
+  "NEWTAB_PAGE_SHOWN": {
+    "expires_in_version": "35",
+    "kind": "boolean",
+    "description": "Number of times about:newtab was shown from opening a new tab or window."
+  },
   "PANORAMA_INITIALIZATION_TIME_MS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "10000",
     "n_buckets": 15,
     "extended_statistics_ok": true,
     "description": "Time it takes to initialize Panorama (ms)"
   },