зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1019298 - Use Telemetry to count which directory links were shown in which tile position [r=adw f=gfritzsche]
Remember the directory index and trigger the telemetry probe for link0-8 and tile0-8.
This commit is contained in:
Родитель
9cffad506e
Коммит
4262c7162e
|
@ -210,7 +210,19 @@ let gPage = {
|
|||
for (let site of gGrid.sites) {
|
||||
if (site) {
|
||||
site.captureIfMissing();
|
||||
let {type} = site.link;
|
||||
|
||||
// Record which tile index a directory link was shown
|
||||
let {directoryIndex, type} = site.link;
|
||||
if (directoryIndex !== undefined) {
|
||||
let tileIndex = site.cell.index;
|
||||
// For telemetry, only handle the first 9 links in the first 9 cells
|
||||
if (directoryIndex < 9) {
|
||||
let shownId = "NEWTAB_PAGE_DIRECTORY_LINK" + directoryIndex + "_SHOWN";
|
||||
Services.telemetry.getHistogramById(shownId).add(Math.min(9, tileIndex));
|
||||
}
|
||||
}
|
||||
|
||||
// Aggregate tile impression counts into directory types
|
||||
if (type in directoryCount) {
|
||||
directoryCount[type]++;
|
||||
}
|
||||
|
|
|
@ -4129,6 +4129,60 @@
|
|||
"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_LINK0_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #0 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK1_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #1 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK2_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #2 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK3_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #3 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK4_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #4 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK5_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #5 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK6_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #6 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK7_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #7 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_LINK8_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track impression count of directory link #8 per index (0-8). Grid configurations showing 9+ tiles fall into the '9' bucket."
|
||||
},
|
||||
"NEWTAB_PAGE_DIRECTORY_AFFILIATE_SHOWN": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
|
|
|
@ -268,6 +268,7 @@ let DirectoryLinksProvider = {
|
|||
this._readDirectoryLinksFile().then(rawLinks => {
|
||||
// all directory links have a frecency of DIRECTORY_FRECENCY
|
||||
aCallback(rawLinks.map((link, position) => {
|
||||
link.directoryIndex = position;
|
||||
link.frecency = DIRECTORY_FRECENCY;
|
||||
link.lastVisitDate = rawLinks.length - position;
|
||||
return link;
|
||||
|
|
|
@ -259,7 +259,7 @@ add_task(function test_linksURL_locale() {
|
|||
|
||||
links = yield fetchData();
|
||||
do_check_eq(links.length, 1);
|
||||
expected_data = [{url: "http://example.com", title: "US", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1}];
|
||||
expected_data = [{url: "http://example.com", title: "US", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1, directoryIndex: 0}];
|
||||
isIdentical(links, expected_data);
|
||||
|
||||
yield promiseDirectoryDownloadOnPrefChange("general.useragent.locale", "zh-CN");
|
||||
|
@ -267,8 +267,8 @@ add_task(function test_linksURL_locale() {
|
|||
links = yield fetchData();
|
||||
do_check_eq(links.length, 2)
|
||||
expected_data = [
|
||||
{url: "http://example.net", title: "CN", frecency: DIRECTORY_FRECENCY, lastVisitDate: 2},
|
||||
{url: "http://example.net/2", title: "CN2", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1}
|
||||
{url: "http://example.net", title: "CN", frecency: DIRECTORY_FRECENCY, lastVisitDate: 2, directoryIndex: 0},
|
||||
{url: "http://example.net/2", title: "CN2", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1, directoryIndex: 1}
|
||||
];
|
||||
isIdentical(links, expected_data);
|
||||
|
||||
|
@ -280,7 +280,7 @@ add_task(function test_DirectoryLinksProvider__prefObserver_url() {
|
|||
|
||||
let links = yield fetchData();
|
||||
do_check_eq(links.length, 1);
|
||||
let expectedData = [{url: "http://example.com", title: "LocalSource", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1}];
|
||||
let expectedData = [{url: "http://example.com", title: "LocalSource", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1, directoryIndex: 0}];
|
||||
isIdentical(links, expectedData);
|
||||
|
||||
// tests these 2 things:
|
||||
|
|
Загрузка…
Ссылка в новой задаче