Skip to content

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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

laghee
Copy link
Collaborator

@laghee laghee commented Apr 4, 2025

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

  • Go to a site
  • Refresh 3 times
  • Verify that RELOAD-2X and RELOAD-3X pixels fire
  • Dismiss prompt
  • Refresh 3 times, pause for at least 20 seconds, then refresh 3 times again
  • Verify that RELOAD-2X and RELOAD-3X fire twice

@laghee laghee requested a review from CrisBarreiro April 4, 2025 13:47
@CrisBarreiro
Copy link
Contributor

@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

}
pixel.fire(AppPixelName.RELOAD_THREE_TIMES_WITHIN_20_SECONDS)
Timber.d("KateTest--> should show bc 3 refreshes")
site?.let { brokenSitePrompt.shouldShowBrokenSitePrompt(it.url) } ?: false
Copy link
Contributor

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),
Copy link
Contributor

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@laghee laghee changed the title [Draft] Update 3x pixel-firing logic to more closely match broken site prompt Update 3x pixel-firing logic to more closely match broken site prompt Apr 21, 2025
@laghee laghee force-pushed the kate/update-refresh-pixel-firing branch from 6c44673 to 1a11483 Compare April 21, 2025 09:06
@laghee laghee marked this pull request as ready for review April 21, 2025 09:06
@laghee laghee removed the request for review from marcosholgado April 23, 2025 05:50
refreshPixelSender.onRefreshPatternDetected(detectedRefreshPatterns)

return if (3 in detectedRefreshPatterns &&
return if (RefreshPattern.THRICE_IN_20_SECONDS in detectedRefreshPatterns &&
brokenSitePrompt.shouldShowBrokenSitePrompt(nonNullSite.url)
Copy link
Contributor

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

@CrisBarreiro
Copy link
Contributor

@laghee, the current implementation behaves like a sliding window. If you refresh 4 times in 20 seconds, 3x pixel is fired twice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants