Skip to content

Commit 69693a1

Browse files
authored
Do not send rq.1 when the user is NOT in the SERP (#1096)
1 parent 7a26978 commit 69693a1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,17 @@ class BrowserTabViewModelTest {
12581258
verify(mockPixel).fire("rq_1")
12591259
}
12601260

1261+
@Test
1262+
fun whenUserSubmittedDifferentQueryAndOldQueryIsUrlThenDoNotSendQueryChangePixel() {
1263+
whenever(mockOmnibarConverter.convertQueryToUrl("another query", null)).thenReturn("another query")
1264+
loadUrl("www.foo.com")
1265+
1266+
testee.onUserSubmittedQuery("another query")
1267+
1268+
verify(mockPixel, never()).fire("rq_0")
1269+
verify(mockPixel, never()).fire("rq_1")
1270+
}
1271+
12611272
@Test
12621273
fun whenUserBrowsingPressesBackAndBrowserCanGoBackThenNavigatesToPreviousPageAndHandledTrue() {
12631274
setupNavigation(isBrowsing = true, canGoBack = true, stepsToPreviousPage = 2)

app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ class BrowserTabViewModel(
545545
val oldQuery = currentOmnibarViewState().omnibarText.toUri()
546546
val newQuery = omnibarText.toUri()
547547

548+
if (Patterns.WEB_URL.matcher(oldQuery.toString()).matches()) return
549+
548550
if (oldQuery == newQuery) {
549551
pixel.fire(String.format(Locale.US, PixelName.SERP_REQUERY.pixelName, PixelParameter.SERP_QUERY_NOT_CHANGED))
550552
} else if (oldQuery.toString().isNotBlank()) { // blank means no previous search, don't send pixel

0 commit comments

Comments
 (0)