Skip to content

Replace missing steps in the dashboard tour #12519

@techanvil

Description

@techanvil

Feature Description

Currently, the dashboard tour shown when Analytics is connected expects both the Key Metrics and Audience Segmentation features to be set up, as it includes steps for each of them. This means the tour doesn’t work properly when either feature is not set up.

To address this, when these features aren't set up, their steps will be removed from the tour, and the Top Search Queries step from the Search Console-only tour will be shown instead. It will be positioned before the Top Content step in the tour.

For reference, see the replace missing steps in the dashboard tour section in the design doc.


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

Acceptance criteria

  • Given that a user sets up Site Kit and connects Analytics without the setupFlowRefresh feature flag enabled, and then enables the feature flag and triggers the dashboard tour:

Implementation Brief

See the implementation guide in the design doc.

  • In assets/js/modules/analytics-4/datastore/audience-settings.js

    • Add a new isAudienceSegmentationSetupCompleted() selector for consistency with CORE_SITE.isKeyMetricsSetupCompleted(). Wrap the existing getAudienceSegmentationSetupCompletedBy() selector using the negateDefined helper from @/js/util/negate so the new selector returns:
      • undefined if audience settings aren't loaded yet
      • false if audienceSegmentationSetupCompletedBy is null/0/falsy
      • true if it's a truthy user ID
    • Implementation should mirror CORE_SITE.isKeyMetricsSetupCompleted (assets/js/googlesitekit/datastore/site/info.js):
  • In assets/js/feature-tours/hooks/useWelcomeTour.ts

    • Read both setup-completion selectors and pass the results into getWelcomeTour:
      • select( CORE_SITE ).isKeyMetricsSetupCompleted()
      • select( MODULES_ANALYTICS_4 ).isAudienceSegmentationSetupCompleted() (the new selector)
    • Coerce each to a strict boolean before passing (mirroring the existing !! isAnalyticsConnected pattern in the same file). Treat undefined (not-yet-loaded) the same as false for tour-step purposes — i.e. omit the step rather than show it against a not-yet-rendered widget.
  • In assets/js/feature-tours/welcome.ts

    • Extend the getWelcomeTour parameter object with two new required booleans: isKeyMetricsSetupCompleted and isAudienceSegmentationSetupCompleted. Update both the inline destructure and the inline type annotation accordingly.
    • In the Analytics-connected branch (the return { slug: WELCOME_TOUR.WITH_ANALYTICS, ... } block), build the steps array conditionally instead of inlining the four steps:
      • Always include the All Traffic step.
      • Include the Key Metrics step only if isKeyMetricsSetupCompleted === true.
      • Include the Audience Segmentation step only if isAudienceSegmentationSetupCompleted === true.
      • Include the Top Content step (always).
      • If either isKeyMetricsSetupCompleted or isAudienceSegmentationSetupCompleted is false, insert the Top Search Queries step immediately before the Top Content step. Insert it only once, regardless of whether one or both of KM/AS are missing.
    • Preserve the existing step order: [ Key Metrics?, All Traffic, Audience Segmentation?, ( Top Search Queries )?, Top Content, Dashboard Sharing ].
    • The Top Search Queries step should be identical to the one used in the SC-only tour (second step of the ! isAnalyticsConnected branch in the same file) — same target, floaterProps.target, title, content, offset, spotlightPadding, placement, and isResponsive. Extract it into a shared getTopSearchQueriesStep() helper function (similar to the existing getDashboardSharingStep and getActivateAnalyticsStep helpers) and call it from both branches to avoid duplication.
    • Keep the existing getDashboardSharingStep( isViewOnly, canAuthenticate, true ) call as the final step in the Analytics-connected branch.

Test Coverage

  • Add tests for the new isAudienceSegmentationSetupCompleted selector in assets/js/modules/analytics-4/datastore/audience-settings.test.js.
  • Update tests for getWelcomeTour in assets/js/feature-tours/welcome.test.ts to cover the KM/AS setup-completion permutations.
  • Update tests for useWelcomeTour in assets/js/feature-tours/hooks/useWelcomeTour.test.ts to verify the new selector values are passed through to getWelcomeTour.

QA Brief

  • Set up Site Kit with Analytics and without setupFlowRefresh
  • Enable setupFlowRefresh after the setup is complete
  • Run the dashboard tour and ensure that there are no missing steps
  • Ensure that the Top Search Queries step is shown when either Key Metrics or Audience Segmentation are not set up
  • Enable Key Metrics and ensure that its step is now included in the tour
  • Enable Audience Segmentation and ensure that its step is now included in the tour
  • Ensure that the Top Search Queries step is no longer part of the tour when both features are enabled
  • Ensure that these two features' respective widgets are not displayed when they're toggled off:
    • Toggle off "Visitor groups" from admin settings
    • Toggle off "Display key metrics in dashboard" from admin settings (you need to disable setupFlowRefresh then enable it back)

Changelog entry

  • Substitute a Top Search Queries step in the dashboard tour when Key Metrics or Audience Segmentation are not yet set up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0High priorityTeam MIssues for Squad 2Type: EnhancementImprovement of an existing feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions