Bug 1748348 - Stop sending search_query and matched_keywords for Firefox Suggest impressions r=adw

Differential Revision: https://phabricator.services.mozilla.com/D135059
This commit is contained in:
Nan Jiang 2022-01-04 20:19:14 +00:00
Родитель 02aad87193
Коммит 9f5b1bf3a2
4 изменённых файлов: 9 добавлений и 44 удалений

Просмотреть файл

@ -296,36 +296,18 @@ class ProviderQuickSuggest extends UrlbarProvider {
let isQuickSuggestLinkClicked = let isQuickSuggestLinkClicked =
details.selIndex == resultIndex && details.selType !== "help"; details.selIndex == resultIndex && details.selType !== "help";
let { let {
qsSuggestion, // The full keyword
sponsoredAdvertiser, sponsoredAdvertiser,
sponsoredImpressionUrl, sponsoredImpressionUrl,
sponsoredClickUrl, sponsoredClickUrl,
sponsoredBlockId, sponsoredBlockId,
source,
requestId, requestId,
} = result.payload; } = result.payload;
let scenario = UrlbarPrefs.get("quicksuggest.scenario"); let scenario = UrlbarPrefs.get("quicksuggest.scenario");
// Collect the search query and matched keywords only when the user has
// opted in to data collection and only for remote settings suggestions.
// Otherwise record those fields as undefined.
let matchedKeywords;
let searchQuery;
if (
UrlbarPrefs.get("quicksuggest.dataCollection.enabled") &&
source === QUICK_SUGGEST_SOURCE.REMOTE_SETTINGS
) {
matchedKeywords = qsSuggestion || details.searchString;
searchQuery = details.searchString;
}
// impression // impression
PartnerLinkAttribution.sendContextualServicesPing( PartnerLinkAttribution.sendContextualServicesPing(
{ {
scenario, scenario,
search_query: searchQuery,
matched_keywords: matchedKeywords,
advertiser: sponsoredAdvertiser, advertiser: sponsoredAdvertiser,
block_id: sponsoredBlockId, block_id: sponsoredBlockId,
position: telemetryResultIndex, position: telemetryResultIndex,

Просмотреть файл

@ -455,7 +455,7 @@ The impression ping payload contains the following:
used to link to a client_id. used to link to a client_id.
:is_clicked: :is_clicked:
Whether or not the user also clicked the suggestion. Whether or not the user also clicked the suggestion.
:matched_keywords: :matched_keywords (**Removed from Firefox 97**):
The matched keywords that lead to the suggestion. This is only included when The matched keywords that lead to the suggestion. This is only included when
the user has opted in to data collection and the suggestion is provided by the user has opted in to data collection and the suggestion is provided by
remote settings. remote settings.
@ -469,7 +469,7 @@ The impression ping payload contains the following:
suggestions provided by Merino. suggestions provided by Merino.
:scenario: :scenario:
The user's Suggest scenario, either "offline" or "online". The user's Suggest scenario, either "offline" or "online".
:search_query: :search_query (**Removed from Firefox 97**):
The exact search query typed by the user. This is only included when the user The exact search query typed by the user. This is only included when the user
has opted in to data collection and the suggestion is provided by remote has opted in to data collection and the suggestion is provided by remote
settings. settings.
@ -501,12 +501,17 @@ Changelog
[Bug 1736117_, 1735976_] [Bug 1736117_, 1735976_]
- ``request_id`` is added to the payload. [Bug 1736117_] - ``request_id`` is added to the payload. [Bug 1736117_]
Firefox 97.0
- Stop sending ``search_query`` and ``matched_keywords`` in the custom
impression ping for Firefox Suggest. [Bug 1748348_]
.. _1689365: https://bugzilla.mozilla.org/show_bug.cgi?id=1689365 .. _1689365: https://bugzilla.mozilla.org/show_bug.cgi?id=1689365
.. _1725492: https://bugzilla.mozilla.org/show_bug.cgi?id=1725492 .. _1725492: https://bugzilla.mozilla.org/show_bug.cgi?id=1725492
.. _1728188: https://bugzilla.mozilla.org/show_bug.cgi?id=1728188 .. _1728188: https://bugzilla.mozilla.org/show_bug.cgi?id=1728188
.. _1729576: https://bugzilla.mozilla.org/show_bug.cgi?id=1729576 .. _1729576: https://bugzilla.mozilla.org/show_bug.cgi?id=1729576
.. _1736117: https://bugzilla.mozilla.org/show_bug.cgi?id=1736117 .. _1736117: https://bugzilla.mozilla.org/show_bug.cgi?id=1736117
.. _1735976: https://bugzilla.mozilla.org/show_bug.cgi?id=1735976 .. _1735976: https://bugzilla.mozilla.org/show_bug.cgi?id=1735976
.. _1748348: https://bugzilla.mozilla.org/show_bug.cgi?id=1748348
Nimbus Exposure Event Nimbus Exposure Event
--------------------- ---------------------

Просмотреть файл

@ -329,16 +329,12 @@ class QSTestUtils {
* *
* @param {number} index * @param {number} index
* The expected zero-based index of the quick suggest result. * The expected zero-based index of the quick suggest result.
* @param {string} search_query
* The search string that triggered the quick suggest result.
* @param {object} spy * @param {object} spy
* A `sinon.spy` object. See `createTelemetryPingSpy`. * A `sinon.spy` object. See `createTelemetryPingSpy`.
* @param {string} [advertiser] * @param {string} [advertiser]
* The expected advertiser in the ping. * The expected advertiser in the ping.
* @param {number} [block_id] * @param {number} [block_id]
* The expected block_id in the ping. * The expected block_id in the ping.
* @param {string} [matched_keywords]
* The expected matched_keywords in the ping.
* @param {string} [reporting_url] * @param {string} [reporting_url]
* The expected reporting_url in the ping. * The expected reporting_url in the ping.
* @param {string} [scenario] * @param {string} [scenario]
@ -349,8 +345,6 @@ class QSTestUtils {
spy, spy,
advertiser = "test-advertiser", advertiser = "test-advertiser",
block_id = 1, block_id = 1,
search_query = undefined,
matched_keywords = search_query,
reporting_url = "http://impression.reporting.test.com/", reporting_url = "http://impression.reporting.test.com/",
scenario = "offline", scenario = "offline",
}) { }) {
@ -367,11 +361,9 @@ class QSTestUtils {
let expectedPayload = { let expectedPayload = {
advertiser, advertiser,
block_id, block_id,
matched_keywords,
position: index + 1, position: index + 1,
reporting_url, reporting_url,
scenario, scenario,
search_query,
}; };
let actualPayload = {}; let actualPayload = {};
for (let key of Object.keys(expectedPayload)) { for (let key of Object.keys(expectedPayload)) {

Просмотреть файл

@ -76,7 +76,6 @@ add_task(async function impression_offline_dataCollectionDisabled() {
UrlbarPrefs.set("quicksuggest.dataCollection.enabled", false); UrlbarPrefs.set("quicksuggest.dataCollection.enabled", false);
await doImpressionTest({ await doImpressionTest({
scenario: "offline", scenario: "offline",
search_query: undefined,
}); });
}); });
@ -89,7 +88,6 @@ add_task(async function impression_offline_dataCollectionEnabled() {
UrlbarPrefs.set("quicksuggest.dataCollection.enabled", true); UrlbarPrefs.set("quicksuggest.dataCollection.enabled", true);
await doImpressionTest({ await doImpressionTest({
scenario: "offline", scenario: "offline",
search_query: TEST_SEARCH_STRING,
}); });
}); });
@ -104,7 +102,6 @@ add_task(async function impression_online_dataCollectionDisabled() {
UrlbarPrefs.set("suggest.quicksuggest.sponsored", true); UrlbarPrefs.set("suggest.quicksuggest.sponsored", true);
await doImpressionTest({ await doImpressionTest({
scenario: "online", scenario: "online",
search_query: undefined,
}); });
}); });
@ -119,11 +116,10 @@ add_task(async function impression_online_dataCollectionEnabled() {
UrlbarPrefs.set("suggest.quicksuggest.sponsored", true); UrlbarPrefs.set("suggest.quicksuggest.sponsored", true);
await doImpressionTest({ await doImpressionTest({
scenario: "online", scenario: "online",
search_query: TEST_SEARCH_STRING,
}); });
}); });
async function doImpressionTest({ scenario, search_query }) { async function doImpressionTest({ scenario }) {
await BrowserTestUtils.withNewTab("about:blank", async () => { await BrowserTestUtils.withNewTab("about:blank", async () => {
spy.resetHistory(); spy.resetHistory();
await UrlbarTestUtils.promiseAutocompleteResultPopup({ await UrlbarTestUtils.promiseAutocompleteResultPopup({
@ -149,7 +145,6 @@ async function doImpressionTest({ scenario, search_query }) {
index, index,
spy, spy,
scenario, scenario,
search_query,
}); });
QuickSuggestTestUtils.assertNoClickPing(spy); QuickSuggestTestUtils.assertNoClickPing(spy);
}); });
@ -216,7 +211,6 @@ add_task(async function click_keyboard_offline_dataCollectionDisabled() {
await doClickTest({ await doClickTest({
useKeyboard: true, useKeyboard: true,
scenario: "offline", scenario: "offline",
search_query: undefined,
}); });
}); });
@ -230,7 +224,6 @@ add_task(async function click_keyboard_offline_dataCollectionEnabled() {
await doClickTest({ await doClickTest({
useKeyboard: true, useKeyboard: true,
scenario: "offline", scenario: "offline",
search_query: TEST_SEARCH_STRING,
}); });
}); });
@ -246,7 +239,6 @@ add_task(async function click_keyboard_online_dataCollectionDisabled() {
await doClickTest({ await doClickTest({
useKeyboard: true, useKeyboard: true,
scenario: "online", scenario: "online",
search_query: undefined,
}); });
}); });
@ -262,7 +254,6 @@ add_task(async function click_keyboard_online_dataCollectionEnabled() {
await doClickTest({ await doClickTest({
useKeyboard: true, useKeyboard: true,
scenario: "online", scenario: "online",
search_query: TEST_SEARCH_STRING,
}); });
}); });
@ -276,7 +267,6 @@ add_task(async function click_mouse_offline_dataCollectionDisabled() {
await doClickTest({ await doClickTest({
useKeyboard: false, useKeyboard: false,
scenario: "offline", scenario: "offline",
search_query: undefined,
}); });
}); });
@ -290,7 +280,6 @@ add_task(async function click_mouse_offline_dataCollectionEnabled() {
await doClickTest({ await doClickTest({
useKeyboard: false, useKeyboard: false,
scenario: "offline", scenario: "offline",
search_query: TEST_SEARCH_STRING,
}); });
}); });
@ -306,7 +295,6 @@ add_task(async function click_mouse_online_dataCollectionDisabled() {
await doClickTest({ await doClickTest({
useKeyboard: false, useKeyboard: false,
scenario: "online", scenario: "online",
search_query: undefined,
}); });
}); });
@ -322,11 +310,10 @@ add_task(async function click_mouse_online_dataCollectionEnabled() {
await doClickTest({ await doClickTest({
useKeyboard: false, useKeyboard: false,
scenario: "online", scenario: "online",
search_query: TEST_SEARCH_STRING,
}); });
}); });
async function doClickTest({ useKeyboard, scenario, search_query }) { async function doClickTest({ useKeyboard, scenario }) {
await BrowserTestUtils.withNewTab("about:blank", async () => { await BrowserTestUtils.withNewTab("about:blank", async () => {
spy.resetHistory(); spy.resetHistory();
await UrlbarTestUtils.promiseAutocompleteResultPopup({ await UrlbarTestUtils.promiseAutocompleteResultPopup({
@ -356,7 +343,6 @@ async function doClickTest({ useKeyboard, scenario, search_query }) {
index, index,
spy, spy,
scenario, scenario,
search_query,
}); });
QuickSuggestTestUtils.assertClickPing({ index, spy, scenario }); QuickSuggestTestUtils.assertClickPing({ index, spy, scenario });
}); });