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

Implement the “Top content” metric handling for missing custom dimension

Open techanvil opened this issue 1 year ago • 0 comments

Feature Description

Implement the ability to create the custom dimension from the "Top content" metric section if it's missing (e.g. the user has archived it in Analytics).

This includes the happy and unhappy paths, excluding those related to redirecting to OAuth if necessary which will be handled separately via https://github.com/google/site-kit-wp/issues/8154.

See audience tiles > "Top content" states and error modal in the design doc.


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

Acceptance criteria

  • In the case where the googlesitekit_post_type doesn't exist (e.g. the user has archived it in Analytics), the "Top content" metric area in an Audience Tile should be displayed in a zero data state which includes an Update CTA.
  • Clicking Update should create the custom dimension. The CTA should show a spinner in the button while the API request is in flight.
  • This should be implemented as per the Figma design.
  • If the API request returns an error, the Error Modal should be displayed.
    • If the request returns a permissions error, the insufficient permissions modal variant should be displayed.
    • Otherwise, the catch-all modal variant will be shown which just includes the Retry button.
      • Note that the copy should be slightly different to that seen on Figma:
        • The title should be: Failed to enable metric
        • The description should be: Oops! Something went wrong. Retry enabling the metric.
      • Clicking the Retry button will re-request the report.
  • The Dashboard Sharing and User Menu buttons should be disabled while the custom dimension is being created in order to help avoid attempting to show multiple modals at once, which could result in modal conflicts.

Implementation Brief

Note: Depending on which issue is implemented first, it could be worth taking a look at the error handling introduced via https://github.com/google/site-kit-wp/issues/8134 to see if can be refactored for reuse.

Note 16 May 2024: Working on #8484 first because the getReportForAllAudiences will be refactored out making the Error selectors simpler.

Audience Tile Error HOC

  • [ ]

Error Component

  • [ ]

Test Coverage

QA Brief

Changelog entry

techanvil avatar Jan 25 '24 11:01 techanvil