commit 7a83369035cd0a744454cf47b78dece514f8dac6
parent 67a598e274b90edc42183a54baf7db086fef241a
Author: Drew Willcoxon <adw@mozilla.com>
Date: Thu, 23 Oct 2025 22:32:06 +0000
Bug 1995362 - Part 4: Record the new online Suggest prefs in the AMP quicksuggest ping. r=daisuke,nanj,urlbar-reviewers
This replaces the `improve_suggest_experience` bool recorded in the AMP ping
with `online_available_and_enabled`. We can't use simply `online.enabled` as the
value because that pref will be true by default for users in all regions,
including regions where online Suggest is not available.
Depends on D269322
Differential Revision: https://phabricator.services.mozilla.com/D269323
Diffstat:
3 files changed, 110 insertions(+), 108 deletions(-)
diff --git a/browser/components/urlbar/metrics.yaml b/browser/components/urlbar/metrics.yaml
@@ -1132,11 +1132,13 @@ quick_suggest:
improve_suggest_experience:
type: boolean
description: >
- Whether the "Improve Suggest Experience" checkbox is checked.
+ Whether online Suggest is available to the user and enabled.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1836283
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1995362
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1836283
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1995362
data_sensitivity:
- interaction
notification_emails:
diff --git a/browser/components/urlbar/private/AmpSuggestions.sys.mjs b/browser/components/urlbar/private/AmpSuggestions.sys.mjs
@@ -284,9 +284,9 @@ export class AmpSuggestions extends SuggestProvider {
// Always use lowercase to make the reporting consistent.
advertiser: result.payload.sponsoredAdvertiser.toLocaleLowerCase(),
blockId: result.payload.sponsoredBlockId,
- improveSuggestExperience: lazy.UrlbarPrefs.get(
- "quicksuggest.dataCollection.enabled"
- ),
+ improveSuggestExperience:
+ lazy.UrlbarPrefs.get("quickSuggestOnlineAvailable") &&
+ lazy.UrlbarPrefs.get("quicksuggest.online.enabled"),
// `position` is 1-based, unlike `rowIndex`, which is zero-based.
position: result.rowIndex + 1,
suggestedIndex: result.suggestedIndex.toString(),
diff --git a/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_ping_amp.js b/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_ping_amp.js
@@ -33,37 +33,20 @@ add_task(async function amp() {
let advertiser = SUGGESTION.advertiser.toLowerCase();
let source = "rust";
- // Make sure `improveSuggestExperience` is recorded correctly depending on the
- // value of the related pref.
- for (let improveSuggestExperience of [false, true]) {
- await SpecialPowers.pushPrefEnv({
- set: [
- [
- "browser.urlbar.quicksuggest.dataCollection.enabled",
- improveSuggestExperience,
+ // Make sure `improveSuggestExperience` is recorded correctly.
+ for (let onlineAvailable of [false, true]) {
+ for (let onlineEnabled of [false, true]) {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["browser.urlbar.quicksuggest.online.available", onlineAvailable],
+ ["browser.urlbar.quicksuggest.online.enabled", onlineEnabled],
],
- ],
- });
- await doQuickSuggestPingTest({
- index,
- suggestion: SUGGESTION,
- impressionOnly: {
- pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
- matchType,
- advertiser,
- blockId: SUGGESTION.id.toString(),
- improveSuggestExperience,
- position,
- suggestedIndex: "-1",
- suggestedIndexRelativeToGroup: true,
- requestId: undefined,
- source,
- contextId: "",
- isClicked: false,
- reportingUrl: SUGGESTION.impression_url,
- },
- click: [
- {
+ });
+ let improveSuggestExperience = onlineAvailable && onlineEnabled;
+ await doQuickSuggestPingTest({
+ index,
+ suggestion: SUGGESTION,
+ impressionOnly: {
pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
matchType,
advertiser,
@@ -75,82 +58,99 @@ add_task(async function amp() {
requestId: undefined,
source,
contextId: "",
- isClicked: true,
+ isClicked: false,
reportingUrl: SUGGESTION.impression_url,
},
- {
- pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_SELECTION,
- matchType,
- advertiser,
- blockId: SUGGESTION.id.toString(),
- improveSuggestExperience,
- position,
- suggestedIndex: "-1",
- suggestedIndexRelativeToGroup: true,
- requestId: undefined,
- source,
- contextId: "",
- reportingUrl: SUGGESTION.click_url,
- },
- ],
- commands: [
- {
- command: "dismiss",
- pings: [
- {
- pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
- matchType,
- advertiser,
- blockId: SUGGESTION.id.toString(),
- improveSuggestExperience,
- position,
- suggestedIndex: "-1",
- suggestedIndexRelativeToGroup: true,
- requestId: undefined,
- source,
- contextId: "",
- isClicked: false,
- reportingUrl: SUGGESTION.impression_url,
- },
- {
- pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_BLOCK,
- matchType,
- advertiser,
- blockId: SUGGESTION.id.toString(),
- improveSuggestExperience,
- position,
- suggestedIndex: "-1",
- suggestedIndexRelativeToGroup: true,
- requestId: undefined,
- source,
- contextId: "",
- iabCategory: SUGGESTION.iab_category,
- },
- ],
- },
- {
- command: "manage",
- pings: [
- {
- pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
- matchType,
- advertiser,
- blockId: SUGGESTION.id.toString(),
- improveSuggestExperience,
- position,
- suggestedIndex: "-1",
- suggestedIndexRelativeToGroup: true,
- requestId: undefined,
- source,
- contextId: "",
- isClicked: false,
- reportingUrl: SUGGESTION.impression_url,
- },
- ],
- },
- ],
- });
- await SpecialPowers.popPrefEnv();
+ click: [
+ {
+ pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
+ matchType,
+ advertiser,
+ blockId: SUGGESTION.id.toString(),
+ improveSuggestExperience,
+ position,
+ suggestedIndex: "-1",
+ suggestedIndexRelativeToGroup: true,
+ requestId: undefined,
+ source,
+ contextId: "",
+ isClicked: true,
+ reportingUrl: SUGGESTION.impression_url,
+ },
+ {
+ pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_SELECTION,
+ matchType,
+ advertiser,
+ blockId: SUGGESTION.id.toString(),
+ improveSuggestExperience,
+ position,
+ suggestedIndex: "-1",
+ suggestedIndexRelativeToGroup: true,
+ requestId: undefined,
+ source,
+ contextId: "",
+ reportingUrl: SUGGESTION.click_url,
+ },
+ ],
+ commands: [
+ {
+ command: "dismiss",
+ pings: [
+ {
+ pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
+ matchType,
+ advertiser,
+ blockId: SUGGESTION.id.toString(),
+ improveSuggestExperience,
+ position,
+ suggestedIndex: "-1",
+ suggestedIndexRelativeToGroup: true,
+ requestId: undefined,
+ source,
+ contextId: "",
+ isClicked: false,
+ reportingUrl: SUGGESTION.impression_url,
+ },
+ {
+ pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_BLOCK,
+ matchType,
+ advertiser,
+ blockId: SUGGESTION.id.toString(),
+ improveSuggestExperience,
+ position,
+ suggestedIndex: "-1",
+ suggestedIndexRelativeToGroup: true,
+ requestId: undefined,
+ source,
+ contextId: "",
+ iabCategory: SUGGESTION.iab_category,
+ },
+ ],
+ },
+ {
+ command: "manage",
+ pings: [
+ {
+ pingType: CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION,
+ matchType,
+ advertiser,
+ blockId: SUGGESTION.id.toString(),
+ improveSuggestExperience,
+ position,
+ suggestedIndex: "-1",
+ suggestedIndexRelativeToGroup: true,
+ requestId: undefined,
+ source,
+ contextId: "",
+ isClicked: false,
+ reportingUrl: SUGGESTION.impression_url,
+ },
+ ],
+ },
+ ],
+ });
+ await SpecialPowers.popPrefEnv();
+ }
}
});