-
Notifications
You must be signed in to change notification settings - Fork 973
Update 3x pixel-firing logic to more closely match broken site prompt #5862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
@laghee, If I understand correctly, the logic to reset refresh count is not affected (reset once 3x or more refreshes), however, if the user refreshes 4x, we'd only send the 2x once. Not sure if that's expected / what iOS does in that case |
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
} | ||
pixel.fire(AppPixelName.RELOAD_THREE_TIMES_WITHIN_20_SECONDS) | ||
Timber.d("KateTest--> should show bc 3 refreshes") | ||
site?.let { brokenSitePrompt.shouldShowBrokenSitePrompt(it.url) } ?: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess null site here is an edge case here, so probably fine if pixel and prompt fall out of sync
} | ||
|
||
val dismissStreakResetDays = brokenSiteReportRepository.getDismissStreakResetDays().toLong() | ||
val dismissalCount = brokenSiteReportRepository.getDismissalCountBetween( | ||
currentTimestamp.minusDays(dismissStreakResetDays), | ||
currentTimestamp.minusMinutes(dismissStreakResetDays), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful to revert this later
|
||
return dismissalCount < brokenSiteReportRepository.getMaxDismissStreak() | ||
} | ||
|
||
override suspend fun ctaShown() { | ||
val currentTimestamp = currentTimeProvider.localDateTimeNow() | ||
val newNextShownDate = currentTimestamp.plusDays(brokenSiteReportRepository.getCoolDownDays()) | ||
val newNextShownDate = currentTimestamp.plusSeconds(brokenSiteReportRepository.getCoolDownDays()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/browser/refreshpixels/RefreshPixelSender.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/test/java/com/duckduckgo/app/browser/refreshpixels/RefreshPixelSenderTest.kt
Outdated
Show resolved
Hide resolved
app/src/test/java/com/duckduckgo/app/browser/refreshpixels/RefreshPixelSenderTest.kt
Show resolved
Hide resolved
app/src/test/java/com/duckduckgo/app/browser/refreshpixels/RefreshPixelSenderTest.kt
Show resolved
Hide resolved
...n-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSiteRefreshesInMemoryStore.kt
Outdated
Show resolved
Hide resolved
.../broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSiteReportRepository.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
6c44673
to
1a11483
Compare
...n-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSiteRefreshesInMemoryStore.kt
Outdated
Show resolved
Hide resolved
refreshPixelSender.onRefreshPatternDetected(detectedRefreshPatterns) | ||
|
||
return if (3 in detectedRefreshPatterns && | ||
return if (RefreshPattern.THRICE_IN_20_SECONDS in detectedRefreshPatterns && | ||
brokenSitePrompt.shouldShowBrokenSitePrompt(nonNullSite.url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd send refresh patterns here to encapsulate all the logic in shouldShowBrokenSitePrompt
@laghee, the current implementation behaves like a sliding window. If you refresh 4 times in 20 seconds, 3x pixel is fired twice |
Task/Issue URL: https://app.asana.com/0/72649045549333/1209712075249435/f
Description
We decided in https://app.asana.com/0/1205142657210376/1209698956036733 that we would prefer the separate 3x pixel to fire for distinct 3-refresh groupings in the chosen time period as opposed to 3 refreshes that fall into a sliding window of time to more closely match the breakage prompt trigger.
Steps to test this PR
NB: Logic is currently patched to delay 7 seconds between accepted prompts & stop prompting with 3+ dismissals within the past 30 min.
Feature 1