Bug 1800993 - Add telemetry for dynamic wikipedia results. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D162253
This commit is contained in:
Dale Harvey 2022-12-09 21:29:38 +00:00
parent b010741cdc
commit 3c8fccf233
7 changed files with 491 additions and 73 deletions

View File

@ -20,28 +20,29 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarResult: "resource:///modules/UrlbarResult.sys.mjs",
});
const TELEMETRY_PREFIX = "contextual.services.quicksuggest";
const TELEMETRY_SCALARS = {
BLOCK_SPONSORED: "contextual.services.quicksuggest.block_sponsored",
BLOCK_SPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.block_sponsored_bestmatch",
BLOCK_NONSPONSORED: "contextual.services.quicksuggest.block_nonsponsored",
BLOCK_NONSPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.block_nonsponsored_bestmatch",
CLICK: "contextual.services.quicksuggest.click",
CLICK_NONSPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.click_nonsponsored_bestmatch",
CLICK_SPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.click_sponsored_bestmatch",
HELP: "contextual.services.quicksuggest.help",
HELP_NONSPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.help_nonsponsored_bestmatch",
HELP_SPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.help_sponsored_bestmatch",
IMPRESSION: "contextual.services.quicksuggest.impression",
IMPRESSION_NONSPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.impression_nonsponsored_bestmatch",
IMPRESSION_SPONSORED_BEST_MATCH:
"contextual.services.quicksuggest.impression_sponsored_bestmatch",
BLOCK_SPONSORED: `${TELEMETRY_PREFIX}.block_sponsored`,
BLOCK_SPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.block_sponsored_bestmatch`,
BLOCK_DYNAMIC_WIKIPEDIA: `${TELEMETRY_PREFIX}.block_dynamic_wikipedia`,
BLOCK_NONSPONSORED: `${TELEMETRY_PREFIX}.block_nonsponsored`,
BLOCK_NONSPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.block_nonsponsored_bestmatch`,
CLICK_SPONSORED: `${TELEMETRY_PREFIX}.click_sponsored`,
CLICK_NONSPONSORED: `${TELEMETRY_PREFIX}.click_nonsponsored`,
CLICK_NONSPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.click_nonsponsored_bestmatch`,
CLICK_SPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.click_sponsored_bestmatch`,
CLICK_DYNAMIC_WIKIPEDIA: `${TELEMETRY_PREFIX}.click_dynamic_wikipedia`,
HELP_SPONSORED: `${TELEMETRY_PREFIX}.help_sponsored`,
HELP_NONSPONSORED: `${TELEMETRY_PREFIX}.help_nonsponsored`,
HELP_NONSPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.help_nonsponsored_bestmatch`,
HELP_SPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.help_sponsored_bestmatch`,
HELP_DYNAMIC_WIKIPEDIA: `${TELEMETRY_PREFIX}.help_dynamic_wikipedia`,
IMPRESSION_SPONSORED: `${TELEMETRY_PREFIX}.impression_sponsored`,
IMPRESSION_NONSPONSORED: `${TELEMETRY_PREFIX}.impression_nonsponsored`,
IMPRESSION_NONSPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.impression_nonsponsored_bestmatch`,
IMPRESSION_SPONSORED_BEST_MATCH: `${TELEMETRY_PREFIX}.impression_sponsored_bestmatch`,
IMPRESSION_DYNAMIC_WIKIPEDIA: `${TELEMETRY_PREFIX}.impression_dynamic_wikipedia`,
};
/**
@ -438,13 +439,26 @@ class ProviderQuickSuggest extends UrlbarProvider {
// Indexes recorded in quick suggest telemetry are 1-based, so add 1 to the
// 0-based `result.rowIndex`.
let telemetryResultIndex = result.rowIndex + 1;
let isDynamicWikipedia =
result.payload.sponsoredAdvertiser == "dynamic-wikipedia";
// impression scalars
Services.telemetry.keyedScalarAdd(
TELEMETRY_SCALARS.IMPRESSION,
result.payload.isSponsored
? TELEMETRY_SCALARS.IMPRESSION_SPONSORED
: TELEMETRY_SCALARS.IMPRESSION_NONSPONSORED,
telemetryResultIndex,
1
);
if (isDynamicWikipedia) {
Services.telemetry.keyedScalarAdd(
TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA,
telemetryResultIndex,
1
);
}
if (result.isBestMatch) {
Services.telemetry.keyedScalarAdd(
result.payload.isSponsored
@ -459,7 +473,14 @@ class ProviderQuickSuggest extends UrlbarProvider {
let clickScalars = [];
switch (selType) {
case "quicksuggest":
clickScalars.push(TELEMETRY_SCALARS.CLICK);
clickScalars.push(
result.payload.isSponsored
? TELEMETRY_SCALARS.CLICK_SPONSORED
: TELEMETRY_SCALARS.CLICK_NONSPONSORED
);
if (isDynamicWikipedia) {
clickScalars.push(TELEMETRY_SCALARS.CLICK_DYNAMIC_WIKIPEDIA);
}
if (result.isBestMatch) {
clickScalars.push(
result.payload.isSponsored
@ -469,7 +490,14 @@ class ProviderQuickSuggest extends UrlbarProvider {
}
break;
case "help":
clickScalars.push(TELEMETRY_SCALARS.HELP);
clickScalars.push(
result.payload.isSponsored
? TELEMETRY_SCALARS.HELP_SPONSORED
: TELEMETRY_SCALARS.HELP_NONSPONSORED
);
if (isDynamicWikipedia) {
clickScalars.push(TELEMETRY_SCALARS.HELP_DYNAMIC_WIKIPEDIA);
}
if (result.isBestMatch) {
clickScalars.push(
result.payload.isSponsored
@ -484,6 +512,9 @@ class ProviderQuickSuggest extends UrlbarProvider {
? TELEMETRY_SCALARS.BLOCK_SPONSORED
: TELEMETRY_SCALARS.BLOCK_NONSPONSORED
);
if (isDynamicWikipedia) {
clickScalars.push(TELEMETRY_SCALARS.BLOCK_DYNAMIC_WIKIPEDIA);
}
if (result.isBestMatch) {
clickScalars.push(
result.payload.isSponsored
@ -506,6 +537,12 @@ class ProviderQuickSuggest extends UrlbarProvider {
// engagement event
let match_type = result.isBestMatch ? "best-match" : "firefox-suggest";
let suggestion_type = result.payload.isSponsored
? "sponsored"
: "nonsponsored";
if (isDynamicWikipedia) {
suggestion_type = "dynamic-wikipedia";
}
Services.telemetry.recordEvent(
lazy.QuickSuggest.TELEMETRY_EVENT_CATEGORY,
"engagement",
@ -514,9 +551,8 @@ class ProviderQuickSuggest extends UrlbarProvider {
{
match_type,
position: String(telemetryResultIndex),
suggestion_type: result.payload.isSponsored
? "sponsored"
: "nonsponsored",
suggestion_type,
source: result.payload.source,
}
);
@ -536,6 +572,7 @@ class ProviderQuickSuggest extends UrlbarProvider {
),
position: telemetryResultIndex,
request_id: result.payload.requestId,
source: result.payload.source,
};
// impression

View File

@ -118,6 +118,20 @@ Changelog
.. _1755100: https://bugzilla.mozilla.org/show_bug.cgi?id=1755100
.. _1756917: https://bugzilla.mozilla.org/show_bug.cgi?id=1756917
contextual.services.quicksuggest.block_dynamic_wikipedia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user dismisses ("blocks") a
dynamic wikipedia suggestion. Each key is the index at which a suggestion
appeared in the results (1-based), and the corresponding value is the number
of dismissals at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.block_nonsponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -187,7 +201,39 @@ Changelog
Firefox 87.0
Introduced. [Bug 1693927_]
Firefox 109.0
Removed. [Bug 1800993_]
.. _1693927: https://bugzilla.mozilla.org/show_bug.cgi?id=1693927
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.click_dynamic_wikipedia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user picks a dynamic
wikipedia suggestion. Each key is the index at which a suggestion appeared
in the results (1-based), and the corresponding value is the number of
clicks at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.click_nonsponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user picks a non-sponsored
suggestion. Each key is the index at which a suggestion appeared in the
results (1-based), and the corresponding value is the number of clicks at
that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.click_nonsponsored_bestmatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -202,6 +248,19 @@ Changelog
.. _1752953: https://bugzilla.mozilla.org/show_bug.cgi?id=1752953
contextual.services.quicksuggest.click_sponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user picks a sponsored suggestion.
Each key is the index at which a suggestion appeared in the results (1-based),
and the corresponding value is the number of clicks at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.click_sponsored_bestmatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -227,7 +286,39 @@ Changelog
Firefox 87.0
Introduced. [Bug 1693927_]
Firefox 109.0
Removed. [Bug 1800993_]
.. _1693927: https://bugzilla.mozilla.org/show_bug.cgi?id=1693927
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.help_dynamic_wikipedia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user picks the help button in a
dynamic wikipedia suggestion. Each key is the index at which a suggestion
appeared in the results (1-based), and the corresponding value is the number
of help button clicks at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.help_nonsponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user picks the help button in a
non-sponsored suggestion. Each key is the index at which a suggestion appeared in the
results (1-based), and the corresponding value is the number of help button clicks
at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.help_nonsponsored_bestmatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -243,6 +334,20 @@ Changelog
.. _1752953: https://bugzilla.mozilla.org/show_bug.cgi?id=1752953
contextual.services.quicksuggest.help_sponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar is incremented each time the user picks the help button in a
sponsored suggestion. Each key is the index at which a suggestion appeared in the
results (1-based), and the corresponding value is the number of help button clicks
at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.help_sponsored_bestmatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -275,7 +380,52 @@ Changelog
Firefox 87.0
Introduced. [Bug 1693927_]
Firefox 109.0
Removed. [Bug 1800993_]
.. _1693927: https://bugzilla.mozilla.org/show_bug.cgi?id=1693927
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.impression_dynamic_wikipedia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar records dynamic wikipedia impressions. It is incremented
each time the user is shown a dynamic wikipedia suggestion and the following
two conditions hold:
- The user has completed an engagement with the address bar by picking a result
in it or by pressing the Enter key.
- At the time the user completed the engagement, a dynamic wikipedia suggestion
was present in the results.
Each key is the index at which a suggestion appeared in the results (1-based),
and the corresponding value is the number of impressions at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.impression_nonsponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar records suggestion impressions. It is incremented each time
the user is shown a non-sponsored suggestion and the following two conditions hold:
- The user has completed an engagement with the address bar by picking a result
in it or by pressing the Enter key.
- At the time the user completed the engagement, a suggestion was present in the
results.
Each key is the index at which a suggestion appeared in the results (1-based),
and the corresponding value is the number of impressions at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.impression_nonsponsored_bestmatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -298,6 +448,26 @@ Changelog
.. _1752953: https://bugzilla.mozilla.org/show_bug.cgi?id=1752953
contextual.services.quicksuggest.impression_sponsored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This keyed scalar records suggestion impressions. It is incremented each time
the user is shown a sponsored suggestion and the following two conditions hold:
- The user has completed an engagement with the address bar by picking a result
in it or by pressing the Enter key.
- At the time the user completed the engagement, a suggestion was present in the
results.
Each key is the index at which a suggestion appeared in the results (1-based),
and the corresponding value is the number of impressions at that index.
Changelog
Firefox 109.0
Introduced. [Bug 1800993_]
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextual.services.quicksuggest.impression_sponsored_bestmatch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -422,13 +592,20 @@ The event's ``extra`` contains the following properties:
:position:
The index of the suggestion in the list of results (1-based).
:suggestion_type:
The type of suggestion, one of: "sponsored", "nonsponsored"
The type of suggestion, one of: "sponsored", "nonsponsored", "dynamic-wikipedia"
:source:
The source of suggestion, one of: "remote-settings", "merino"
Changelog
Firefox 101.0
Introduced. [Bug 1761059_]
Firefox 109.0
``source`` is added. [Bug 1800993_]
``dynamic-wikipedia`` is added as a value of ``suggestion_type``. [Bug 1800993_]
.. _1761059: https://bugzilla.mozilla.org/show_bug.cgi?id=1761059
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
contextservices.quicksuggest.impression_cap
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -784,6 +961,8 @@ payload includes the following:
:request_id:
A request identifier for each API request to Merino. This is only included for
suggestions provided by Merino.
:source:
The source of the suggestion, either "remote-settings" or "merino".
Changelog
Firefox 101.0
@ -793,8 +972,12 @@ Changelog
``scenario`` is removed from the payload and
``improve_suggest_experience_checked`` is added. [Bug 1776797_]
Firefox 109.0
``source`` is added. [Bug 1800993_]
.. _1764669: https://bugzilla.mozilla.org/show_bug.cgi?id=1764669
.. _1776797: https://bugzilla.mozilla.org/show_bug.cgi?id=1776797
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
Click
~~~~~
@ -824,6 +1007,8 @@ the following:
:request_id:
A request identifier for each API request to Merino. This is only included for
suggestions provided by Merino.
:source:
The source of the suggestion, either "remote-settings" or "merino".
Changelog
Firefox 87.0
@ -843,11 +1028,15 @@ Changelog
``scenario`` is removed from the payload and
``improve_suggest_experience_checked`` is added. [Bug 1776797_]
Firefox 109.0
``source`` is added. [Bug 1800993_]
.. _1689365: https://bugzilla.mozilla.org/show_bug.cgi?id=1689365
.. _1729576: https://bugzilla.mozilla.org/show_bug.cgi?id=1729576
.. _1736117: https://bugzilla.mozilla.org/show_bug.cgi?id=1736117
.. _1754622: https://bugzilla.mozilla.org/show_bug.cgi?id=1754622
.. _1776797: https://bugzilla.mozilla.org/show_bug.cgi?id=1776797
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
Impression
~~~~~~~~~~
@ -890,6 +1079,8 @@ The impression ping payload contains the following:
:request_id:
A request identifier for each API request to Merino. This is only included for
suggestions provided by Merino.
:source:
The source of the suggestion, either "remote-settings" or "merino".
Changelog
Firefox 87.0
@ -933,6 +1124,9 @@ Changelog
``scenario`` is removed from the payload and
``improve_suggest_experience_checked`` is added. [Bug 1776797_]
Firefox 109.0
``source`` is added. [Bug 1800993_]
.. _1689365: https://bugzilla.mozilla.org/show_bug.cgi?id=1689365
.. _1725492: https://bugzilla.mozilla.org/show_bug.cgi?id=1725492
.. _1728188: https://bugzilla.mozilla.org/show_bug.cgi?id=1728188
@ -943,6 +1137,7 @@ Changelog
.. _1754622: https://bugzilla.mozilla.org/show_bug.cgi?id=1754622
.. _1761059: https://bugzilla.mozilla.org/show_bug.cgi?id=1761059
.. _1776797: https://bugzilla.mozilla.org/show_bug.cgi?id=1776797
.. _1800993: https://bugzilla.mozilla.org/show_bug.cgi?id=1800993
Nimbus Exposure Event
---------------------

View File

@ -57,6 +57,7 @@ const DEFAULT_PING_PAYLOADS = {
improve_suggest_experience_checked: false,
match_type: "firefox-suggest",
request_id: null,
source: "remote-settings",
},
[CONTEXTUAL_SERVICES_PING_TYPES.QS_SELECTION]: {
advertiser: "testadvertiser",
@ -66,6 +67,7 @@ const DEFAULT_PING_PAYLOADS = {
match_type: "firefox-suggest",
reporting_url: "http://example.com/click",
request_id: null,
source: "remote-settings",
},
[CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION]: {
advertiser: "testadvertiser",
@ -76,6 +78,7 @@ const DEFAULT_PING_PAYLOADS = {
match_type: "firefox-suggest",
reporting_url: "http://example.com/impression",
request_id: null,
source: "remote-settings",
},
};

View File

@ -181,12 +181,12 @@ async function doBasicBlockTest({ suggestion, isBestMatch, block }) {
// Check telemetry scalars.
let index = 2;
let scalars = {
[TELEMETRY_SCALARS.IMPRESSION]: index,
};
let scalars = {};
if (isSponsored) {
scalars[TELEMETRY_SCALARS.IMPRESSION_SPONSORED] = index;
scalars[TELEMETRY_SCALARS.BLOCK_SPONSORED] = index;
} else {
scalars[TELEMETRY_SCALARS.IMPRESSION_NONSPONSORED] = index;
scalars[TELEMETRY_SCALARS.BLOCK_NONSPONSORED] = index;
}
if (isBestMatch) {

View File

@ -30,7 +30,7 @@ const SUGGESTIONS = [
keywords: ["sponsored"],
click_url: "http://example.com/click",
impression_url: "http://example.com/impression",
advertiser: "TestAdvertiser",
advertiser: "testadvertiser",
},
{
id: 2,
@ -39,9 +39,18 @@ const SUGGESTIONS = [
keywords: ["nonsponsored"],
click_url: "http://example.com/click",
impression_url: "http://example.com/impression",
advertiser: "TestAdvertiser",
advertiser: "testadvertiser",
iab_category: "5 - Education",
},
{
id: 3,
url: "http://example.com/wikipedia",
title: "Dynamic Wikipedia suggestion",
keywords: ["wikipedia"],
click_url: "http://example.com/click",
impression_url: "http://example.com/impression",
advertiser: "dynamic-wikipedia",
},
];
const SPONSORED_SUGGESTION = SUGGESTIONS[0];
@ -178,7 +187,10 @@ async function doImpressionTest({
});
let index = 1;
let isSponsored = suggestion.keywords[0] == "sponsored";
let isDynamicWikipedia = suggestion.advertiser == "dynamic-wikipedia";
let isSponsored =
suggestion.keywords[0] == "sponsored" || isDynamicWikipedia;
await QuickSuggestTestUtils.assertIsQuickSuggest({
window,
index,
@ -194,7 +206,9 @@ async function doImpressionTest({
});
let scalars = {
[TELEMETRY_SCALARS.IMPRESSION]: index + 1,
[isSponsored
? TELEMETRY_SCALARS.IMPRESSION_SPONSORED
: TELEMETRY_SCALARS.IMPRESSION_NONSPONSORED]: index + 1,
};
if (isBestMatch) {
if (isSponsored) {
@ -209,7 +223,17 @@ async function doImpressionTest({
};
}
}
if (isDynamicWikipedia) {
scalars = {
...scalars,
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: index + 1,
};
}
QuickSuggestTestUtils.assertScalars(scalars);
let suggestion_type = isSponsored ? "sponsored" : "nonsponsored";
if (isDynamicWikipedia) {
suggestion_type = "dynamic-wikipedia";
}
QuickSuggestTestUtils.assertEvents([
{
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
@ -218,7 +242,7 @@ async function doImpressionTest({
extra: {
match_type: isBestMatch ? "best-match" : "firefox-suggest",
position: String(index + 1),
suggestion_type: isSponsored ? "sponsored" : "nonsponsored",
suggestion_type,
},
},
]);
@ -231,6 +255,7 @@ async function doImpressionTest({
is_clicked: false,
match_type: isBestMatch ? "best-match" : "firefox-suggest",
position: index + 1,
advertiser: suggestion.advertiser,
},
},
]);
@ -467,7 +492,9 @@ async function doClickTest({
});
let index = 1;
let isSponsored = suggestion.keywords[0] == "sponsored";
let isDynamicWikipedia = suggestion.advertiser == "dynamic-wikipedia";
let isSponsored =
suggestion.keywords[0] == "sponsored" || isDynamicWikipedia;
let result = await QuickSuggestTestUtils.assertIsQuickSuggest({
window,
index,
@ -485,8 +512,12 @@ async function doClickTest({
});
let scalars = {
[TELEMETRY_SCALARS.IMPRESSION]: index + 1,
[TELEMETRY_SCALARS.CLICK]: index + 1,
[isSponsored
? TELEMETRY_SCALARS.IMPRESSION_SPONSORED
: TELEMETRY_SCALARS.IMPRESSION_NONSPONSORED]: index + 1,
[isSponsored
? TELEMETRY_SCALARS.CLICK_SPONSORED
: TELEMETRY_SCALARS.CLICK_NONSPONSORED]: index + 1,
};
if (isBestMatch) {
if (isSponsored) {
@ -503,9 +534,20 @@ async function doClickTest({
};
}
}
if (isDynamicWikipedia) {
scalars = {
...scalars,
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: index + 1,
[TELEMETRY_SCALARS.CLICK_DYNAMIC_WIKIPEDIA]: index + 1,
};
}
QuickSuggestTestUtils.assertScalars(scalars);
let match_type = isBestMatch ? "best-match" : "firefox-suggest";
let suggestion_type = isSponsored ? "sponsored" : "nonsponsored";
if (isDynamicWikipedia) {
suggestion_type = "dynamic-wikipedia";
}
QuickSuggestTestUtils.assertEvents([
{
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
@ -514,7 +556,7 @@ async function doClickTest({
extra: {
match_type,
position: String(index + 1),
suggestion_type: isSponsored ? "sponsored" : "nonsponsored",
suggestion_type,
},
},
]);
@ -527,6 +569,7 @@ async function doClickTest({
is_clicked: true,
block_id: suggestion.id,
position: index + 1,
advertiser: suggestion.advertiser,
},
},
{
@ -536,6 +579,7 @@ async function doClickTest({
match_type,
block_id: suggestion.id,
position: index + 1,
advertiser: suggestion.advertiser,
},
},
]);
@ -581,8 +625,8 @@ add_task(async function click_beforeSearchSuggestions() {
});
// Arrow down to the quick suggest result and press Enter.
QuickSuggestTestUtils.assertScalars({
[TELEMETRY_SCALARS.IMPRESSION]: index + 1,
[TELEMETRY_SCALARS.CLICK]: index + 1,
[TELEMETRY_SCALARS.IMPRESSION_SPONSORED]: index + 1,
[TELEMETRY_SCALARS.CLICK_SPONSORED]: index + 1,
});
QuickSuggestTestUtils.assertEvents([
{
@ -669,7 +713,8 @@ async function doHelpTest({ suggestion, useKeyboard, isBestMatch = false }) {
fireInputEvent: true,
});
let index = 1;
let isSponsored = suggestion.keywords[0] == "sponsored";
let isDynamicWikipedia = suggestion.advertiser == "dynamic-wikipedia";
let isSponsored = suggestion.keywords[0] == "sponsored" || isDynamicWikipedia;
let result = await QuickSuggestTestUtils.assertIsQuickSuggest({
window,
index,
@ -697,8 +742,12 @@ async function doHelpTest({ suggestion, useKeyboard, isBestMatch = false }) {
);
let scalars = {
[TELEMETRY_SCALARS.IMPRESSION]: index + 1,
[TELEMETRY_SCALARS.HELP]: index + 1,
[isSponsored
? TELEMETRY_SCALARS.IMPRESSION_SPONSORED
: TELEMETRY_SCALARS.IMPRESSION_NONSPONSORED]: index + 1,
[isSponsored
? TELEMETRY_SCALARS.HELP_SPONSORED
: TELEMETRY_SCALARS.HELP_NONSPONSORED]: index + 1,
};
if (isBestMatch) {
if (isSponsored) {
@ -715,9 +764,20 @@ async function doHelpTest({ suggestion, useKeyboard, isBestMatch = false }) {
};
}
}
if (isDynamicWikipedia) {
scalars = {
...scalars,
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: index + 1,
[TELEMETRY_SCALARS.HELP_DYNAMIC_WIKIPEDIA]: index + 1,
};
}
QuickSuggestTestUtils.assertScalars(scalars);
let match_type = isBestMatch ? "best-match" : "firefox-suggest";
let suggestion_type = isSponsored ? "sponsored" : "nonsponsored";
if (isDynamicWikipedia) {
suggestion_type = "dynamic-wikipedia";
}
QuickSuggestTestUtils.assertEvents([
{
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
@ -726,7 +786,7 @@ async function doHelpTest({ suggestion, useKeyboard, isBestMatch = false }) {
extra: {
match_type,
position: String(index + 1),
suggestion_type: isSponsored ? "sponsored" : "nonsponsored",
suggestion_type,
},
},
]);
@ -738,6 +798,7 @@ async function doHelpTest({ suggestion, useKeyboard, isBestMatch = false }) {
block_id: suggestion.id,
is_clicked: false,
position: index + 1,
advertiser: suggestion.advertiser,
},
},
]);
@ -1354,7 +1415,7 @@ add_task(async function impression_previousResultStillVisible() {
// An impression for the first suggestion should be recorded since it's
// still visible in the view, not the second suggestion.
QuickSuggestTestUtils.assertScalars({
[TELEMETRY_SCALARS.IMPRESSION]: index + 1,
[TELEMETRY_SCALARS.IMPRESSION_SPONSORED]: index + 1,
});
QuickSuggestTestUtils.assertEvents([
{

View File

@ -3299,7 +3299,9 @@ contextservices.quicksuggest:
position: >
The index of the suggestion in the list of results (1-based).
suggestion_type: >
The type of suggestion, one of: "sponsored", "nonsponsored"
The type of suggestion, one of: "sponsored", "nonsponsored", "dynamic-wikipedia"
source: >
Where the suggestion came from, one of: "remote-settings", "merino"
release_channel_collection: opt-out
products:
- "firefox"

View File

@ -7535,18 +7535,35 @@ contextual.services.topsites:
contextual.services.quicksuggest:
impression:
impression_dynamic_wikipedia:
bug_numbers:
- 1693927
- 1800993
description: >
A keyed uint recording how many times the user has viewed Firefox Suggest
(a.k.a. Quick Suggest) results in the urlbar. The key is the 1-based index
of each result.
A keyed uint recording how many times the user has viewed sponsored
Firefox Suggest dynamic wikipedia results in the urlbar. The
key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- najiang@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
impression_nonsponsored:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has viewed non-sponsored
Firefox Suggest (a.k.a. Quick Suggest) results in the urlbar. The key is
the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7563,7 +7580,24 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
impression_sponsored:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has viewed sponsored Firefox
Suggest (a.k.a. Quick Suggest) results in the urlbar. The key is the 1-based
index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7580,24 +7614,41 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
click:
click_dynamic_wikipedia:
bug_numbers:
- 1693927
- 1800993
description: >
A keyed uint recording how many times the user has clicked on Firefox
Suggests (a.k.a. Quick Suggest) results in the urlbar (not including the
Suggest dynamic wikipedia results in the urlbar (not including the
help button). The key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- najiang@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
click_nonsponsored:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has clicked on non-sponsored
Firefox Suggests (a.k.a. Quick Suggest) results in the urlbar (not
including the help button). The key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7615,7 +7666,24 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
click_sponsored:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has clicked on sponsored
Firefox Suggests (a.k.a. Quick Suggest) results in the urlbar (not
including the help button). The key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7632,24 +7700,42 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
help:
help_dynamic_wikipedia:
bug_numbers:
- 1693927
- 1800993
description: >
A keyed uint recording how many times the user has clicked on the help
button in Firefox Suggests (a.k.a. Quick Suggest) results in the urlbar.
The key is the 1-based index of each result.
button in sponsored Firefox Suggest dynamic wikipedia results
in the urlbar (not including the help button). The key is the 1-based
index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- najiang@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
help_nonsponsored:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has clicked on the help
button in non-sponsored Firefox Suggests (a.k.a. Quick Suggest) results in
the urlbar. The key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7667,7 +7753,24 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
help_sponsored:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has clicked on the help
button in sponsored Firefox Suggests (a.k.a. Quick Suggest) results in
the urlbar. The key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7685,7 +7788,24 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
block_dynamic_wikipedia:
bug_numbers:
- 1800993
description: >
A keyed uint recording how many times the user has blocked/dismissed
sponsored Firefox Suggest dynamic wikipedia results in the
urlbar. The key is the 1-based index of each result.
expires: never
kind: uint
keyed: true
notification_emails:
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7702,7 +7822,7 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7719,7 +7839,7 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7736,7 +7856,7 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
@ -7753,7 +7873,7 @@ contextual.services.quicksuggest:
kind: uint
keyed: true
notification_emails:
- adw@mozilla.com
- fx-search-telemetry@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'