mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 18:50:08 +00:00
Bug 972930 - Clicks (raw number) for tiles [r=adw]
Provide an array of expected directory link types to count how many were clicked.
This commit is contained in:
parent
d848823ffd
commit
81dab972bb
@ -11,6 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/PageThumbs.jsm");
|
||||
Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm");
|
||||
Cu.import("resource://gre/modules/DirectoryLinksProvider.jsm");
|
||||
Cu.import("resource://gre/modules/NewTabUtils.jsm");
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
|
||||
|
@ -189,6 +189,13 @@ Site.prototype = {
|
||||
}
|
||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_SITE_CLICKED")
|
||||
.add(aIndex);
|
||||
|
||||
// Specially count clicks on directory tiles
|
||||
let typeIndex = DirectoryLinksProvider.linkTypes.indexOf(this.link.type);
|
||||
if (typeIndex != -1) {
|
||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_DIRECTORY_TYPE_CLICKED")
|
||||
.add(typeIndex);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -4041,6 +4041,12 @@
|
||||
"n_values": 10,
|
||||
"description": "Track click count on about:newtab tiles per index (0-8). For non-default row or column configurations all clicks into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_TYPE_CLICKED": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 3,
|
||||
"description": "Track click count on about:newtab directory links per type (sponsored, affiliate, organic)."
|
||||
},
|
||||
"PANORAMA_INITIALIZATION_TIME_MS": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
|
@ -60,6 +60,12 @@ const PREF_DIRECTORY_SOURCE = "browser.newtabpage.directorySource";
|
||||
// The frecency of a directory link
|
||||
const DIRECTORY_FRECENCY = 1000;
|
||||
|
||||
const LINK_TYPES = Object.freeze([
|
||||
"sponsored",
|
||||
"affiliate",
|
||||
"organic",
|
||||
]);
|
||||
|
||||
/**
|
||||
* Singleton that serves as the provider of directory links.
|
||||
* Directory links are a hard-coded set of links shown if a user's link
|
||||
@ -89,6 +95,8 @@ let DirectoryLinksProvider = {
|
||||
return this.__linksURL;
|
||||
},
|
||||
|
||||
get linkTypes() LINK_TYPES,
|
||||
|
||||
observe: function DirectoryLinksProvider_observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "nsPref:changed") {
|
||||
if (aData == this._prefs["linksURL"]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user