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

Add Audience Reset class to reset Audience settings across all users on Analytics property change. #9328

Merged

Conversation

benbowler
Copy link
Collaborator

@benbowler benbowler commented Sep 11, 2024

Summary

Addresses issue:

Relevant technical choices

Overall my implementation matched the IB with some small changes such as, moving all resets within the reset_audience_data function rather than leaving resets of the settings in register. I also created a new reset method on Audience_Settings to allow for full reset of the settings bypassing some sanitisation that prevented the merge method from being able to fully reset the data.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Copy link

github-actions bot commented Sep 11, 2024

Build files for 2479dd6 have been deleted.

Copy link
Collaborator

@nfmohit nfmohit left a comment

Choose a reason for hiding this comment

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

Excellent work here, @benbowler !

  1. I've pointed out an issue with configuredAudiences not being set to the default value, causing some unexpected side-effects, such as the setup CTA banner not appearing. We should probably consider deleting the option entirely instead.
  2. I've also pointed out some minor observations.
  3. Could we expand the QAB especially in regards to the part which references dismissed prompts or items? Instead, I think we should specify what the QA specialist should see visually in their UI, e.g. see the setup CTA banner, the success notification, etc.
  4. Apart from the above, this is a very nitpicky observation, but when I took a look at the code comments added in this PR (which are very helpful), I noticed a usage of inconsistent casing of words, for example Audience Settings instead of audience settings, etc. This is very nitpicky, but if we have capacity, could we review these and update for consistency? Ideally, any references to class names (e.g. Dismissed_Prompts) should appear as the class name itself, and any reference to feature names (e.g. Audience Segmentation) can be capitalised. Otherwise, everything else can just use natural casing.

Please let me know if you have any questions, thank you!

includes/Modules/Analytics_4/Reset_Audiences.php Outdated Show resolved Hide resolved
includes/Core/User/Audience_Settings.php Outdated Show resolved Hide resolved
includes/Modules/Analytics_4/Reset_Audiences.php Outdated Show resolved Hide resolved
includes/Modules/Analytics_4.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@nfmohit nfmohit left a comment

Choose a reason for hiding this comment

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

Thank you so much for making the updates, @benbowler. I've left one last comment. Please let me know what you think, thanks!

includes/Modules/Analytics_4/Reset_Audiences.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@nfmohit nfmohit left a comment

Choose a reason for hiding this comment

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

Thank you for making the update, @benbowler.

On my final review, I noticed quite a significant issue that I've pointed out below. As we are in sort of a time constraint here, I hope you wouldn't mind if I went ahead and made the changes myself.

Thank you!

includes/Modules/Analytics_4/Reset_Audiences.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@nfmohit nfmohit left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @benbowler !

Comment on lines +327 to +329
$new_value['availableCustomDimensions'] = null;
$new_value['availableAudiences'] = null;
$new_value['audienceSegmentationSetupCompletedBy'] = null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @nfmohit, thanks for applying this fix.

It does strike me that we could have taken an alternative route of overriding the Analytics_4::Settings::merge() method, to allow null to be merged for these properties. This would allow us to use merge() as we want to and keep the audience-related reset logic encapsulated within Reset_Audiences as originally intended.

Could I please as you to create a followup issue as an Audience Segmentation P2 where we can explore this further?

I'll go ahead and merge this for now. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Absolutely, I've created #9388 as a follow-up, thanks Tom!

Copy link
Collaborator

@techanvil techanvil left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @benbowler and @nfmohit.

@techanvil techanvil merged commit c8f0469 into develop Sep 20, 2024
19 of 22 checks passed
@techanvil techanvil deleted the enhancement/8180-changing-analytics-property-name-AS branch September 20, 2024 10:45
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