Skip to content

Ensure the "Top content" CTA for creating the custom dimension appears when the corresponding report error shows the custom dimension is missing #9218

Closed
@techanvil

Description

Feature Description

The Audience Tile's "Top content" metric area has a CTA for creating the googlesitekit_post_type custom dimension if it doesn't exist.

However, it doesn't have logic in place to determine if the custom dimension doesn't exist when requesting the report for the metric. At present it's reliant on the list of available custom dimensions being synced somewhere, which only happens during Audience Segmentation setup, or in the Key Metrics feature.

We should ensure that, if the report for the "Top content" metric returns an error because the custom dimension doesn't exist, the list of custom dimensions is resynced so the tile will immediately know that the dimension is missing and show the CTA to create it.


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

Acceptance criteria

  • If the reports for the Audience Tile's "Top content" metric return an error because the custom dimension doesn't exist:

Implementation Brief

Add Missing Custom Dimension to Top Content Report

  • Add the googlesitekit_post_type dimension filter to the top content report options:
 dimensionFilters: { 
 	'customEvent:googlesitekit_post_type': { 
 		filterType: 'stringFilter', 
 		matchType: 'EXACT', 
 		value: 'post', 
 	}, 
 }, 

const topContentReportOptions = {
startDate,
endDate,
dimensions: [ 'pagePath' ],
metrics: [ { name: 'screenPageViews' } ],
orderby: [ { metric: { metricName: 'screenPageViews' }, desc: true } ],
limit: 3,
};

const topContentPageTitlesReportOptions = {
startDate,
endDate,
dimensions: [ 'pagePath', 'pageTitle' ],
metrics: [ { name: 'screenPageViews' } ],
orderby: [ { metric: { metricName: 'screenPageViews' }, desc: true } ],
limit: 15,
};

Authenticated User Context

View-Only Context

Test Coverage

  • Update the tests that fail due to the addition of the custom dimension filter for the Top Content queries.
  • Create a VRT when the tile is in the view-only context with an invalid custom dimension error for the Top Content report.

QA Brief

Authenticated user

  • Set up Site Kit with the audienceSegmentation feature flag enabled and Analytics connected to a property which is out of the "gathering data" state.
  • Click on Enable groups to set up Audience Segmentation.
  • Archive the googlesitekit_post_type custom dimension in Analytics.
  • Return to Site Kit and clear session storage: sessionStorage.clear() in the JS console.
  • Refresh the dashboard.
  • Error messages including the phrase "Field customEvent:googlesitekit_post_type is not a valid dimension." will appear in the JS console, this is to be expected.
  • A POST request to the sync-custom-dimensions endpoint should appear in the network devtools.
  • The Update CTA should appear in the "Top content" metric area in the Audience Tiles.

View-only user

  • Having run through the steps above, share Analytics and login as a view-only user with access to the module.
  • The "Top content" metric area should not appear in the Audience Tiles.

Changelog entry

  • Ensure the "Top content" CTA for creating the googlesitekit_post_type custom dimension appears in the main dashboard when the corresponding report error indicates the missing custom dimension.

Metadata

Assignees

No one assigned

    Labels

    Module: AnalyticsGoogle Analytics module related issuesP1Medium priorityTeam MIssues for Squad 2Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions