Skip to content

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

Open

Description

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.

admin-settings-not-synced.mov

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():

*resetAccounts() {
const { dispatch } = yield commonActions.getRegistry();
yield {
payload: {},
type: RESET_ACCOUNTS,
};
yield errorStoreActions.clearErrors( 'getAccounts' );
return dispatch( MODULES_ADSENSE ).invalidateResolutionForStoreSelector(
'getAccounts'
);
},

  • Dispatch the *resetAudienceSettings() action in the Analytics submitChanges() function when the call to saveSettings() has run without erroring:

const { error } = await saveSettings( select, dispatch );
if ( error ) {
return { error };
}
await API.invalidateCache( 'modules', 'analytics-4' );

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Module: AnalyticsGoogle Analytics module related issuesP0High priorityTeam MIssues for Squad 2Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions