site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

The “Display Visitor Groups in Dashboard” toggle still visible after changing the Analytics account

Open wpdarren opened this issue 1 year ago • 2 comments

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

  1. Enable Audience Segmentation.
  2. Go to the settings page and navigate to the Admin settings.
  3. Go the Connected services and change the Analytics account without refreshing the page.
  4. Go to the Admin settings again.
  5. 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 the audienceSettings state to its initial undefined value, clear errors for getAudienceSettings, and invalidate the getAudienceSettings resolver. 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 Analytics submitChanges() function when the call to saveSettings() 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.

wpdarren avatar Oct 08 '24 07:10 wpdarren

IB ✅

nfmohit avatar Oct 14 '24 20:10 nfmohit

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

mohitwp avatar Oct 23 '24 00:10 mohitwp