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 =
details.selIndex == resultIndex && details.selType !== "help";
let {
qsSuggestion, // The full keyword
sponsoredAdvertiser,
sponsoredImpressionUrl,
sponsoredClickUrl,
sponsoredBlockId,
source,
requestId,
} = result.payload;
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
PartnerLinkAttribution.sendContextualServicesPing(
{
scenario,
search_query: searchQuery,
matched_keywords: matchedKeywords,
advertiser: sponsoredAdvertiser,
block_id: sponsoredBlockId,
position: telemetryResultIndex,

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

@ -455,7 +455,7 @@ The impression ping payload contains the following:
used to link to a client_id.
:is_clicked:
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 user has opted in to data collection and the suggestion is provided by
remote settings.
@ -469,7 +469,7 @@ The impression ping payload contains the following:
suggestions provided by Merino.
:scenario:
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
has opted in to data collection and the suggestion is provided by remote
settings.
@ -501,12 +501,17 @@ Changelog
[Bug 1736117_, 1735976_]
- ``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
.. _1725492: https://bugzilla.mozilla.org/show_bug.cgi?id=1725492
.. _1728188: https://bugzilla.mozilla.org/show_bug.cgi?id=1728188
.. _1729576: https://bugzilla.mozilla.org/show_bug.cgi?id=1729576
.. _1736117: https://bugzilla.mozilla.org/show_bug.cgi?id=1736117
.. _1735976: https://bugzilla.mozilla.org/show_bug.cgi?id=1735976
.. _1748348: https://bugzilla.mozilla.org/show_bug.cgi?id=1748348
Nimbus Exposure Event
---------------------

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

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

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

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