Bug 1860919 - Send Glean pings for Wikipedia Firefox Suggestion impressions and clicks.

This commit:

* Adds new facts, `wikipedia_suggestion_clicked` and
  `wikipedia_suggestion_impressed`, to the `feature-fxsuggest`
  component.
* Emits `fx-suggest` Glean pings for those facts in Fenix's
  `MetricController`.

(cherry picked from commit a98251ffdfdb3d945927706dc859feff9694a4f4)
fenix/120.0
Lina Butler 7 months ago committed by mergify[bot]
parent 2424fbde37
commit 49ffda17b8

@ -10895,7 +10895,7 @@ fx_suggest:
block_id:
type: quantity
description: |
A unique identifier for the suggestion (a.k.a. a keywords block).
A unique identifier for a sponsored suggestion. Not set for non-sponsored suggestions.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1857092
data_reviews:
@ -10951,7 +10951,8 @@ fx_suggest:
reporting_url:
type: url
description: |
The url to report this interaction to.
If this ping is for a sponsored suggestion, the partner URL for reporting this interaction.
Not set for non-sponsored suggestions.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1857092
data_reviews:
@ -10987,7 +10988,8 @@ fx_suggest:
iab_category:
type: string
description: |
The suggestion's category. Either "22 - Shopping" or "5 - Educational".
The suggestion's advertising category. "22 - Shopping" for sponsored suggestions.
Not set for non-sponsored suggestions.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1857092
data_reviews:

@ -280,23 +280,33 @@ internal class ReleaseMetricController(
}
}
Component.FEATURE_FXSUGGEST to FxSuggestFacts.Items.AMP_SUGGESTION_CLICKED -> {
Component.FEATURE_FXSUGGEST to FxSuggestFacts.Items.AMP_SUGGESTION_CLICKED,
Component.FEATURE_FXSUGGEST to FxSuggestFacts.Items.WIKIPEDIA_SUGGESTION_CLICKED,
-> {
FxSuggest.pingType.set("fxsuggest-click")
FxSuggest.isClicked.set(true)
(metadata?.get(FxSuggestFacts.MetadataKeys.POSITION) as? Long)?.let {
FxSuggest.position.set(it)
}
(metadata?.get(FxSuggestFacts.MetadataKeys.INTERACTION_INFO) as? FxSuggestInteractionInfo.Amp)?.let {
FxSuggest.blockId.set(it.blockId)
FxSuggest.advertiser.set(it.advertiser)
FxSuggest.reportingUrl.set(it.reportingUrl)
FxSuggest.iabCategory.set(it.iabCategory)
FxSuggest.contextId.set(UUID.fromString(it.contextId))
when (val clickInfo = metadata?.get(FxSuggestFacts.MetadataKeys.INTERACTION_INFO)) {
is FxSuggestInteractionInfo.Amp -> {
FxSuggest.blockId.set(clickInfo.blockId)
FxSuggest.advertiser.set(clickInfo.advertiser)
FxSuggest.reportingUrl.set(clickInfo.reportingUrl)
FxSuggest.iabCategory.set(clickInfo.iabCategory)
FxSuggest.contextId.set(UUID.fromString(clickInfo.contextId))
}
is FxSuggestInteractionInfo.Wikipedia -> {
FxSuggest.advertiser.set("wikipedia")
FxSuggest.contextId.set(UUID.fromString(clickInfo.contextId))
}
}
Pings.fxSuggest.submit()
}
Component.FEATURE_FXSUGGEST to FxSuggestFacts.Items.AMP_SUGGESTION_IMPRESSED -> {
Component.FEATURE_FXSUGGEST to FxSuggestFacts.Items.AMP_SUGGESTION_IMPRESSED,
Component.FEATURE_FXSUGGEST to FxSuggestFacts.Items.WIKIPEDIA_SUGGESTION_IMPRESSED,
-> {
FxSuggest.pingType.set("fxsuggest-impression")
(metadata?.get(FxSuggestFacts.MetadataKeys.IS_CLICKED) as? Boolean)?.let {
FxSuggest.isClicked.set(it)
@ -304,12 +314,18 @@ internal class ReleaseMetricController(
(metadata?.get(FxSuggestFacts.MetadataKeys.POSITION) as? Long)?.let {
FxSuggest.position.set(it)
}
(metadata?.get(FxSuggestFacts.MetadataKeys.INTERACTION_INFO) as? FxSuggestInteractionInfo.Amp)?.let {
FxSuggest.blockId.set(it.blockId)
FxSuggest.advertiser.set(it.advertiser)
FxSuggest.reportingUrl.set(it.reportingUrl)
FxSuggest.iabCategory.set(it.iabCategory)
FxSuggest.contextId.set(UUID.fromString(it.contextId))
when (val impressionInfo = metadata?.get(FxSuggestFacts.MetadataKeys.INTERACTION_INFO)) {
is FxSuggestInteractionInfo.Amp -> {
FxSuggest.blockId.set(impressionInfo.blockId)
FxSuggest.advertiser.set(impressionInfo.advertiser)
FxSuggest.reportingUrl.set(impressionInfo.reportingUrl)
FxSuggest.iabCategory.set(impressionInfo.iabCategory)
FxSuggest.contextId.set(UUID.fromString(impressionInfo.contextId))
}
is FxSuggestInteractionInfo.Wikipedia -> {
FxSuggest.advertiser.set("wikipedia")
FxSuggest.contextId.set(UUID.fromString(impressionInfo.contextId))
}
}
Pings.fxSuggest.submit()
}

Loading…
Cancel
Save