site-kit-wp
site-kit-wp copied to clipboard
The “Display Visitor Groups in Dashboard” toggle still visible after changing the Analytics account
Bug Description
Reported during the bug bash. Asana ticket here
The "Display visitor groups in dashboard" toggle remains visible in the Admin settings instead of the setup visitors CTA after changing the Analytics account without refreshing the page. This occurs because the audience-settings is not synced.
https://github.com/user-attachments/assets/f2e8c890-ac6b-4f10-8202-4ee0adab68f7
Steps to reproduce
- Enable Audience Segmentation.
- Go to the settings page and navigate to the Admin settings.
- Go the Connected services and change the Analytics account without refreshing the page.
- Go to the Admin settings again.
- Observe that the "Display visitor groups in dashboard" toggle is visible, indicating that the audience-settings is not synced as expected.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When the connected Analytics property is changed, the "Display visitor groups in dashboard" toggle in the "Visitor groups" settings section should immediately be replaced with the "Enable groups" CTA.
Implementation Brief
- [ ] Add a new
*resetAudienceSettings()action to the audiences settings store. This should dispatch an action whose reducer sets theaudienceSettingsstate to its initialundefinedvalue, clear errors forgetAudienceSettings, and invalidate thegetAudienceSettingsresolver. For an example see*resetAccounts():
https://github.com/google/site-kit-wp/blob/3ff3c69cce3f17ec310f57e0a3cfe8aebe2e2759/assets/js/modules/adsense/datastore/accounts.js#L51-L64
- [ ] Dispatch the
*resetAudienceSettings()action in the AnalyticssubmitChanges()function when the call tosaveSettings()has run without erroring:
https://github.com/google/site-kit-wp/blob/3ff3c69cce3f17ec310f57e0a3cfe8aebe2e2759/assets/js/modules/analytics-4/datastore/settings.js#L158-L164
Test Coverage
- Add test coverage for the above changes.
- Fix any failing tests.
QA Brief
- Run through the steps to reproduce.
- Verify that the Enable groups CTA appears in the Visitor groups Settings section, rather than the Display visitor groups in dashboard toggle.
Changelog entry
- Fix an issue that caused the visitor groups visibility toggle to appear when the feature wasn't yet set up.
IB ✅
QA Update ✅
- Tested on dev environment.
- Confirm that issue is resolve now.
- Verified that when the connected Analytics property is changed, the "Display visitor groups in dashboard" toggle in the "Visitor groups" settings section immediately be replaced with the "Enable groups" CTA.
https://github.com/user-attachments/assets/0f1e8f6c-413b-4d0f-98c2-84cdbbc73593