Skip to content

Fix Analytics account creation in the new setup flow#12239

Open
fresh3nough wants to merge 1 commit intogoogle:developfrom
fresh3nough:fix/12194-analytics-account-creation-key-metrics-setup
Open

Fix Analytics account creation in the new setup flow#12239
fresh3nough wants to merge 1 commit intogoogle:developfrom
fresh3nough:fix/12194-analytics-account-creation-key-metrics-setup

Conversation

@fresh3nough
Copy link
Copy Markdown

Summary

Addresses issue:

Relevant technical choices

When creating a new Analytics account during the setup flow, the user lands on the Key Metrics setup screen where the Complete setup button remains stuck in a disabled, in-progress state. This happens because the background sync of audiences and custom dimensions is triggered before the Analytics 4 settings (including propertyID) have been resolved from the server. As a result, propertyID resolves to undefined, causing the isSyncing check to stay true indefinitely.

This fix awaits the resolution of the MODULES_ANALYTICS_4 getSettings() resolver before triggering the background sync of audiences and custom dimensions in KeyMetricsSetupApp. This ensures propertyID is available when the sync actions are dispatched, allowing isSyncing to correctly transition to false once syncing completes.

Changes:

  • Added a useSelect hook in KeyMetricsSetupApp that triggers and tracks the resolution of Analytics 4 settings via getSettings() and hasFinishedResolution('getSettings')
  • Updated the sync useEffect to conditionally fire only after settings have resolved
  • Added a test verifying that sync does not trigger while settings are still loading
  • Pre-populated Analytics 4 settings in the test beforeEach to support the new resolver call

Steps to reproduce

  1. Set up Site Kit with the setupFlowRefresh feature flag enabled, and the Analytics checkbox selected on the splash screen
  2. Create a new Analytics account as part of the setup flow
  3. When landing on the Key Metrics setup screen, verify the Complete setup button is enabled and the user can proceed to the dashboard

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.
  • Ensure there are no unexpected significant changes to file sizes.

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.

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.

1 participant