Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
d6efa19a
Unverified
Commit
d6efa19a
authored
Jan 26, 2022
by
Roger Yang
Committed by
GitHub
Jan 26, 2022
Browse files
No issue: Add valid channel set (#11622)
parent
a4a7867a
Changes
2
Hide whitespace changes
Inline
Side-by-side
components/feature/search/src/main/java/mozilla/components/feature/search/telemetry/Utils.kt
View file @
d6efa19a
...
...
@@ -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
()
}
...
...
components/feature/search/src/test/java/mozilla/components/feature/search/telemetry/incontent/InContentTelemetryTest.kt
View file @
d6efa19a
...
...
@@ -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"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment