Skip to content
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

Fix news P3A enabled metric #18701

Merged
merged 1 commit into from
Jun 15, 2023
Merged

Fix news P3A enabled metric #18701

merged 1 commit into from
Jun 15, 2023

Conversation

DJAndries
Copy link
Collaborator

@DJAndries DJAndries commented Jun 1, 2023

Resolves brave/brave-browser#30709

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Follow plan in #18375

@DJAndries DJAndries force-pushed the news-p3a-enabled-fix branch 2 times, most recently from d664e03 to 69fc60f Compare June 1, 2023 23:46
@@ -57,6 +58,9 @@ namespace {
// The favicon size we desire. The favicons are rendered at 24x24 pixels but
// they look quite a bit nicer if we get a 48x48 pixel icon and downscale it.
constexpr uint32_t kDesiredFaviconSizePixels = 48;
// Since we have two boolean prefs for the News enabled status, a delay
// will be used so that we only report the histogram once for both pref updates.
Copy link
Member

Choose a reason for hiding this comment

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

What's the problem with reporting the histogram twice - won't it just report only the most recent value for this metric?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not quite, it seems that when a user presses "no thanks" on Android, both prefs will be enabled in the first call, and then the "show today" pref will be disabled in the second call. if we don't have the timer, the first call will set the "was enabled" pref to true which will result in the "is enabled" metric being reported as 0 in the second call, which we don't want. the timer is here to make sure all edge cases are covered and increases robustness

Copy link
Member

Choose a reason for hiding this comment

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

This seems like a bug from Android. We should locate that part @deeppandya @tapanmodh ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@petemill sure. I'll check it

@DJAndries DJAndries merged commit e113e6d into master Jun 15, 2023
@DJAndries DJAndries deleted the news-p3a-enabled-fix branch June 15, 2023 19:22
@github-actions github-actions bot added this to the 1.54.x - Nightly milestone Jun 15, 2023
@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Jun 23, 2023

Verification PASSED on

Brave | 1.55.5 Chromium: 115.0.5790.32 (Official Build) nightly (64-bit)
-- | --
Revision | f9b78cf410ecd5b372310ef25a12ef456c77d90f-refs/branch-heads/5790@{#724}
OS | Windows 10 Version 22H2 (Build 19045.3086)
  1. Clean profile 1.55.5
  2. Open an NTP and scroll down to view brave news welcome screen and click on the No thanks button
  3. Open brave://local-state
  4. Look for the metrics Brave.Today.IsEnabled
  5. Confirmed that the metrics Brave.Today.IsEnabled response value is 0 as expected
  6. Open 2nd NTP
  7. Click on the Customize->Brave News->Turn on Brave news via NTP dashboard settings in 2nd NTP
  8. Reload brave://local-state, the metrics Brave.Today.IsEnabled response is still 0 instead of 1
  9. Open 3rd NTP and view brave news feeds
  10. Reload brave://local-state, the metrics Brave.Today.IsEnabled response is still 0 instead of 1
  11. Exit the browser and restart
  12. Reload brave://local-state, the metrics Brave.Today.IsEnabled response is still 0 instead of 1
step 5 step 7 step 8 step 9 step 10 step 12
image image image image image image

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