@ -283,12 +283,33 @@ internal class ReleaseMetricController(
Component . FEATURE _FXSUGGEST to FxSuggestFacts . Items . AMP _SUGGESTION _CLICKED ,
Component . FEATURE _FXSUGGEST to FxSuggestFacts . Items . WIKIPEDIA _SUGGESTION _CLICKED ,
-> {
val clickInfo = metadata ?. get ( FxSuggestFacts . MetadataKeys . INTERACTION _INFO )
// Record an event for this click in the `events` ping. These events include the `client_id`.
when ( clickInfo ) {
is FxSuggestInteractionInfo . Amp -> {
Awesomebar . sponsoredSuggestionClicked . record (
Awesomebar . SponsoredSuggestionClickedExtra (
provider = " amp " ,
) ,
)
}
is FxSuggestInteractionInfo . Wikipedia -> {
Awesomebar . nonSponsoredSuggestionClicked . record (
Awesomebar . NonSponsoredSuggestionClickedExtra (
provider = " wikipedia " ,
) ,
)
}
}
// Submit a separate `fx-suggest` ping for this click. These pings do not include the `client_id`.
FxSuggest . pingType . set ( " fxsuggest-click " )
FxSuggest . isClicked . set ( true )
( metadata ?. get ( FxSuggestFacts . MetadataKeys . POSITION ) as ? Long ) ?. let {
FxSuggest . position . set ( it )
}
when ( val clickInfo = metadata ?. get ( FxSuggestFacts . MetadataKeys . INTERACTION _INFO ) ) {
when ( clickInfo ) {
is FxSuggestInteractionInfo . Amp -> {
FxSuggest . blockId . set ( clickInfo . blockId )
FxSuggest . advertiser . set ( clickInfo . advertiser )
@ -307,6 +328,34 @@ internal class ReleaseMetricController(
Component . FEATURE _FXSUGGEST to FxSuggestFacts . Items . AMP _SUGGESTION _IMPRESSED ,
Component . FEATURE _FXSUGGEST to FxSuggestFacts . Items . WIKIPEDIA _SUGGESTION _IMPRESSED ,
-> {
val impressionInfo = metadata ?. get ( FxSuggestFacts . MetadataKeys . INTERACTION _INFO )
val engagementAbandoned = metadata ?. get ( FxSuggestFacts . MetadataKeys . ENGAGEMENT _ABANDONED ) as ? Boolean
?: false
// Record an event for this impression in the `events` ping. These events include the `client_id`, and
// we record them for engaged and abandoned search sessions.
when ( impressionInfo ) {
is FxSuggestInteractionInfo . Amp -> {
Awesomebar . sponsoredSuggestionImpressed . record (
Awesomebar . SponsoredSuggestionImpressedExtra (
provider = " amp " ,
engagementAbandoned = engagementAbandoned ,
) ,
)
}
is FxSuggestInteractionInfo . Wikipedia -> {
Awesomebar . nonSponsoredSuggestionImpressed . record (
Awesomebar . NonSponsoredSuggestionImpressedExtra (
provider = " wikipedia " ,
engagementAbandoned = engagementAbandoned ,
) ,
)
}
}
// Submit a separate `fx-suggest` ping for this impression. These pings do not include the `client_id`,
// and we submit them for engaged search sessions only.
if ( ! engagementAbandoned ) {
FxSuggest . pingType . set ( " fxsuggest-impression " )
( metadata ?. get ( FxSuggestFacts . MetadataKeys . IS _CLICKED ) as ? Boolean ) ?. let {
FxSuggest . isClicked . set ( it )
@ -314,7 +363,7 @@ internal class ReleaseMetricController(
( metadata ?. get ( FxSuggestFacts . MetadataKeys . POSITION ) as ? Long ) ?. let {
FxSuggest . position . set ( it )
}
when ( val impressionInfo = metadata ?. get ( FxSuggestFacts . MetadataKeys . INTERACTION _INFO ) ) {
when ( impressionInfo ) {
is FxSuggestInteractionInfo . Amp -> {
FxSuggest . blockId . set ( impressionInfo . blockId )
FxSuggest . advertiser . set ( impressionInfo . advertiser )
@ -330,6 +379,9 @@ internal class ReleaseMetricController(
Pings . fxSuggest . submit ( )
}
Unit
}
Component . FEATURE _PWA to ProgressiveWebAppFacts . Items . HOMESCREEN _ICON _TAP -> {
ProgressiveWebApp . homescreenTap . record ( NoExtras ( ) )
}