Unverified Commit 27f5b198 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub
Browse files

No issue: Add valid channel set (#11622) (#11624)

(cherry picked from commit d6efa19a

)
Co-authored-by: default avatarRoger Yang <royang@mozilla.com>
parent 5c6316e8
......@@ -22,6 +22,7 @@ private val validCodeSet = setOf(
"ffab", "ffcm", "ffhp", "ffip", "ffit", "ffnt", "ffocus", "ffos", "ffsb", "fpas", "fpsa",
"ftas", "ftsa", "newext", "1000969a", null
)
private val validChannelSet = setOf("ts")
/**
* Get a String in a specific format allowing to identify how an ads/search provider was used.
......@@ -70,7 +71,13 @@ internal fun getTrackKey(
// For Bing if it didn't have a valid cookie and for all the other search engines
if (hasValidCode(uri.getQueryParameter(provider.codeParam), provider)) {
val channel = uri.getQueryParameter(CHANNEL_KEY)
var channel = uri.getQueryParameter(CHANNEL_KEY)
// For Bug 1751955
if (!validChannelSet.contains(channel)) {
channel = null
}
val type = getSapType(provider.followOnParams, paramSet)
return TrackKeyInfo(provider.name, type, code, channel).createTrackKey()
}
......
......@@ -203,6 +203,25 @@ class InContentTelemetryTest {
assertEquals("google.in-content.sap-follow-on.firefox-b-m.ts", facts[0].value)
}
@Test
fun `GIVEN an invalid Google channel from topSite WHEN trackPartnerUrlTypeMetric is called THEN emit an appropriate IN_CONTENT_SEARCH fact`() {
val url = "https://www.google.com/search?q=aaa&client=firefox-b-m&channel=tsTest&oq=random"
val facts = mutableListOf<Fact>()
Facts.registerProcessor(object : FactProcessor {
override fun process(fact: Fact) {
facts.add(fact)
}
})
telemetry.trackPartnerUrlTypeMetric(url, listOf())
assertEquals(1, facts.size)
assertEquals(Component.FEATURE_SEARCH, facts[0].component)
assertEquals(Action.INTERACTION, facts[0].action)
assertEquals(InContentTelemetry.IN_CONTENT_SEARCH, facts[0].item)
assertEquals("google.in-content.sap-follow-on.firefox-b-m", facts[0].value)
}
@Test
fun `GIVEN a Baidu sap-follow-on WHEN trackPartnerUrlTypeMetric is called THEN emit an appropriate IN_CONTENT_SEARCH fact`() {
val url = "https://m.baidu.com/s?from=1000969a&word=aaa&oq=random"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment