Skip to content

Standardise custom dimension creation across the Key Metrics, Audience Segmentation and Site Goals notices #13552

Closed

Description

@jimmymadon

Feature Description

Site Kit asks the user to create Analytics custom dimensions from three separate places, and each of them creates a different subset today:

  • Key Metrics — the metrics selection panel notice and the per-tile "Update" CTA create only the dimensions required by the metric tiles the user has selected, i.e. some of googlesitekit_post_date, googlesitekit_post_author, googlesitekit_post_categories and googlesitekit_post_type.
  • Audience Segmentation — the "Top content" tile CTA creates only googlesitekit_post_type, and it bypasses the shared createCustomDimensions action entirely, calling fetchCreateCustomDimension directly.
  • Site Goals — the "Get breakdown" CTA already creates every dimension in CUSTOM_DIMENSION_DEFINITIONS.

The result is that accepting one notice does not clear the others: a user who enables the Audience Segmentation top content metric is still shown the Key Metrics notice when they select an author or category tile, and is still shown the Site Goals breakdown CTA. Each acceptance costs a round trip to the Analytics Admin API and, when the user lacks the Analytics edit scope, a separate OAuth redirect. All three notices should therefore create the same complete set of custom dimensions.

Auto-enabling the Plugin Conversion Tracking setting is deliberately not standardised alongside this. It is only genuinely required for the Site Goals breakdown and should only be enabled from the "Enable breakdown CTA" as before.

If Plugin Conversion Tracking is already enabled AND Site Kit's custom dimensions have been created from the actioning of a CTA from either Key Metrics or Audience Segmentation, then there is no need to show the "Enable Breakdown CTA" and breakdown should already be enabled once both these conditions are met. If any or both of the above conditions aren't met, then the appropriate version of the Enable Breakdown CTA will continue to display.

Design doc: [SK] Site Goals Enhancements - Mini Design Doc – "Standardise Custom Dimensions creation across all notices"

Related: #13398 (auto-enabling Plugin Conversion Tracking from the Site Goals breakdown CTA only).


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

Acceptance criteria

Implementation Brief

  • Update assets/js/modules/analytics-4/datastore/constants.ts
    • Rename SITE_GOALS_CUSTOM_DIMENSIONS to ALL_CUSTOM_DIMENSIONS, keeping its Object.keys( CUSTOM_DIMENSION_DEFINITIONS ) definition. The name is already misleading — it holds every dimension, not the Site Goals subset — and it becomes the single list every CTA creates.
    • Update its three call sites (custom-dimensions.js, SettingsAdvancedDataBreakdowns.tsx, SettingsAdvancedDataBreakdowns.test.tsx).
  • Update assets/js/modules/analytics-4/datastore/custom-dimensions.js
    • In createCustomDimensions, replace the required-dimension computation with ALL_CUSTOM_DIMENSIONS: drop the KEY_METRICS_WIDGETS lookup over getKeyMetrics(), the deduplication, and the isAdvancedDataBreakdownsEnabled gate that currently decides whether the Site Goals dimensions are included.
    • Drop the now-unused customDimensions parameter and the getKeyMetricsSettings, getUserInputSettings and getAdvancedDataBreakdownsSettings awaits at the top of the action, keeping only the getSettings await needed for getPropertyID().
    • Leave the rest of the action as is: the getCustomDimensions( propertyID ) read, the missing-dimension filter, the receiveIsCustomDimensionGatheringData call per created dimension, and the fetchSyncAvailableCustomDimensions at the end.
    • Add an @since n.e.x.t line to the docblock recording that the action now always creates every Site Kit custom dimension.
    • Note that this removes the last behavioural consumer of the per-property advancedDataBreakdowns flag — SettingsAdvancedDataBreakdowns only reads hasAllCustomDimensions for its display state. Leave the setting in place here; retiring it is a separate clean-up.
  • Update the call sites that passed an explicit list to createCustomDimensions, so they call it with no arguments:
    • assets/js/modules/analytics-4/hooks/useBreakdownEnableHandler.ts — remove the local ALL_CUSTOM_DIMENSIONS constant and import the shared one from the datastore constants for its inProgress selector and its FORM_CUSTOM_DIMENSIONS_CREATE form value.
    • assets/js/modules/analytics-4/components/site-goals/goal-drivers/TopAuthorsGoalDriver.tsx — keep TOP_AUTHORS_REQUIRED_CUSTOM_DIMENSIONS for the "which dimension am I waiting on" selectors, but stop passing it to createCustomDimensions.
    • assets/js/modules/analytics-4/components/site-goals/selection-panel/CustomDimensionsNotice.tsx — same: requiredCustomDimensions still drives hasCustomDimensions and the busy state, but not the creation call.
    • assets/js/modules/analytics-4/hooks/useCreateCustomDimensionsEffect.js — keep reading the customDimensions form value as the hasExplicitCustomDimensions gate for the OAuth-return auto-submit, but call createCustomDimensions() without it.
  • Update assets/js/modules/analytics-4/hooks/useCreateCustomDimensionForAudienceEffect.js
    • Replace the fetchCreateCustomDimension( propertyID, CUSTOM_DIMENSION_DEFINITIONS.googlesitekit_post_type ), receiveIsCustomDimensionGatheringData and fetchSyncAvailableCustomDimensions sequence with a single await createCustomDimensions(); the action already does all three for each missing dimension.
    • propertyID is no longer read here, since the action resolves it itself.
  • Update assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/hooks/useCreateCustomDimension.ts
    • Make isCreatingCustomDimension true while any dimension in ALL_CUSTOM_DIMENSIONS is being created, instead of only googlesitekit_post_type.
    • In onCancel, clear the createCustomDimension action error for every dimension in ALL_CUSTOM_DIMENSIONS, not only googlesitekit_post_type.
  • Update assets/js/modules/analytics-4/components/audience-segmentation/dashboard/CustomDimensionErrorModal.tsx
    • Pass the errors for all of ALL_CUSTOM_DIMENSIONS to AudienceErrorModal's apiErrors, filtered to those that are set, rather than the single googlesitekit_post_type error.
  • Update assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTile/AudienceTilePagesMetric.js
    • hasMissingCustomDimension keeps checking googlesitekit_post_type only — that is the dimension this tile reports on — but customDimensionError, which drives shouldShowErrorModal, should be true for a failure on any of ALL_CUSTOM_DIMENSIONS.
  • Require plugin conversion tracking alongside the breakdown dimension, wherever the breakdown's on/off state is derived. Each of these currently checks hasCustomDimensions( breakdownDimension ) on its own and should also require isConversionTrackingEnabled() from CORE_SITE:
    • assets/js/modules/analytics-4/components/site-goals/hooks/useSiteGoalsBreakdown.tsx — and update the comment above hasBreakdownDimension, which currently states that creating the dimension is what turns the breakdown on.
    • assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownNoticeArea.tsx — fold the condition into hasBreakdownDimensions / getBreakdownDimensionState so the notice and the widget stay in sync. Enable Plugin Conversion Tracking from the Site Goals breakdown CTA with a disclosure variant of the notice #13398 already reads isConversionTrackingEnabled in this component to pick the notice variant, so the two should land on one shared selector rather than two reads.
    • assets/js/modules/analytics-4/components/site-goals/components/GatheringBreakdownDataBadge.tsx, assets/js/modules/analytics-4/components/site-goals/hooks/useSiteGoalsWidgetViewAction.tsx and assets/js/modules/analytics-4/components/site-goals/SiteGoalsSurveyTriggers.tsx — so the badge, the view event and the survey trigger do not fire for a breakdown that is not rendered.
    • Hold the existing "not yet loaded" state while isConversionTrackingEnabled() reads undefined, so the widget does not flash the aggregated state before the setting resolves.
    • A shared hook or selector is worth extracting here, since five call sites need the same pair of conditions.

Test Coverage

  • datastore/custom-dimensions.test.js — createCustomDimensions creates every dimension whatever the selected metric tiles and the advanced data breakdowns setting, and creates only the missing ones when some already exist. Rewrite the existing assertions for the key-metrics-derived list and the breakdowns gate.
  • hooks/useCreateCustomDimensionForAudienceEffect.test.ts (new file) — the Audience Segmentation CTA creates every dimension, leaves plugin conversion tracking off, and clears its form values once creation settles, including on failure.
  • AudienceTilesWidget/hooks/useCreateCustomDimension.test.ts — isSaving covers any dimension being created, and onCancel clears the error for every dimension.
  • KeyMetrics/MetricsSelectionPanel/index.test.js and utils/withCustomDimensions.test.js — both Key Metrics CTAs create every dimension and leave plugin conversion tracking unchanged.
  • useSiteGoalsBreakdown.test.tsx and BreakdownNoticeArea.test.tsx — the breakdown renders only when the dimensions exist and conversion tracking is on; the notice shows in the other three combinations; neither renders while the setting is still loading.
  • GatheringBreakdownDataBadge.test.tsx and SiteGoalsSurveyTriggers.test.tsx — neither fires for a site that has the dimensions but conversion tracking off.
  • Add the conversion tracking settings to the setup of the remaining tests that render BreakdownNoticeArea, the Site Goals widgets, or the Audience Segmentation top content tile.
  • No new Storybook story: the notice variants this gating shows are added in Enable Plugin Conversion Tracking from the Site Goals breakdown CTA with a disclosure variant of the notice #13398.
  • No VRT changes expected.

QA Brief

Setup: Site Kit connected with Analytics, on a property with no Site Kit custom dimensions (googlesitekit_*). Archive them in GA Admin → Custom definitions, or use a fresh property, before each scenario.

  1. Key Metrics: Select an author or category tile in the metrics selection panel and save (or click "Update" on a tile which requires these custom dimensions, ie. Top authors, top categories, etc.). Check that all five dimensions are created in GA: googlesitekit_post_date, googlesitekit_post_author, googlesitekit_post_categories, googlesitekit_post_type, googlesitekit_event_provider.
  2. Audience Segmentation: Click the CTA on the "Top content" tile. Check that all five dimensions are created.
  3. After either CTA, check that none of the other custom dimension notices show (Key Metrics, Top content, Site Goals).
  4. After the Key Metrics or Audience Segmentation CTA, check that Plugin Conversion Tracking is unchanged in Settings → Admin Settings.
  5. Site Goals breakdown:
    • If the dimensions exist and conversion tracking is on, the breakdown shows automatically, with no "Get breakdown" notice.
    • If the dimensions exist and conversion tracking is off, the notice still shows its conversion tracking variant.
    • The "Get breakdown" CTA and the "Enable" button in Analytics settings → advanced data breakdowns still work as before.
  6. Run a CTA again when all the dimensions already exist. It should finish without an error and not create duplicates.

Changelog entry

  • Standardize custom dimension notices and creation throughout plugin.

Activity

  1. added
    P1Medium priority
    Type: EnhancementImprovement of an existing feature
    Next UpIssues to prioritize for definition
    Team SIssues for Squad 1
    on Sep 14, 2026
  2. self-assigned this
    on Sep 14, 2026
  3. removed their assignment
    on Sep 23, 2026
  4. self-assigned this
    on Sep 23, 2026
  5. tofumatt commented on Sep 23, 2026

    @tofumatt
    Collaborator

    IB ✅

  6. removed
    Next UpIssues to prioritize for definition
    on Sep 23, 2026
  7. removed their assignment
    on Sep 28, 2026
  8. removed their assignment
    on Oct 5, 2026
  9. self-assigned this
    on Oct 7, 2026
  10. kelvinballoo commented on Oct 8, 2026

    @kelvinballoo
    Collaborator

    QA update ⚠️

    Tested this and it's mostly good. I just have 2 observations to flag:

    ITEM 1:
    So it seems like if I have plugin conversion tracking as OFF:

    • If I enable site goals breakdown from the dashboard, the plugin conversion tracking is automatically switched on.
    • If I enable site goals breakdown from the analytics module settings, the plugin conversion tracking remains OFF.

    To me, the plugin conversion tracking should be switched on when I enabled it from the analytics module. Thoughts?

    Video attached for reference.

    Details
    13552.-.breakdown.enabled.from.settings.not.good.mov

    ITEM 2:
    Let's say I enabled site goals breakdown already and then turned off Plugin conversion tracking, the notice will show up on the main dashboard for enabling breakdown without any 'Gathering breakdown data' badge.

    However, when I checked a view only user, the user will see a 'Gathering breakdown data'.

    This feels out of sync. Should we hide the badge in view-only user if the Plugin conversion tracking is off?

    Details
    13552.-.07.-.View.only.user.vs.admin.issue.mov
  11. jimmymadon commented on Oct 12, 2026

    @jimmymadon
    CollaboratorAuthor

    @kelvinballoo The first item is precisely part of the AC that only the notice from the Site Goals widget should switch on Plugin Conversion Tracking. This is because that action is the only action that we are "sure" that the user is doing to enable the breakdown on the Site Goals site and not just add extra data to Audience Segmentation or Key Metrics widgets.

    For Item 2, I realised that there is an issue that was supposed to be created to show a notice if Plugin conversion reporting is disabled AFTER the breakdown was enabled. This was originally planned as per the SGE epic but somehow it slipped the net in the updates I made to the design doc after my last few calls with @sigal-teller where a decision on this was pending! I have created Issue #13832 which will define what exactly should happen in this situation as both the above scenarios are not ideal. This is a very rare edge case though so we can do this in the upcoming sprint.

    c.c. @binnieshah

  12. kelvinballoo commented on Oct 12, 2026

    @kelvinballoo
    Collaborator

    Hi @jimmymadon

    Agreed on Key Metrics and Audience Segmentation.

    • That said, my point was specifically about the “Enable” button in Analytics settings → advanced data breakdowns.

      Details Image
    • Like the dashboard CTA, its only purpose is to enable the breakdown, so by the same reasoning it seems like it should also turn on Plugin Conversion Tracking. Right?

    • As it stands, with PCT off, clicking “Enable” in settings creates the dimensions, but the breakdown still doesn’t show on the dashboard (since it now requires PCT too), so the settings and dashboard states disagree. Should the settings button match the dashboard CTA, or should this go to a follow-up issue?

  13. jimmymadon commented on Oct 13, 2026

    @jimmymadon
    CollaboratorAuthor

    @kelvinballoo I had originally discussed this with @sigal-teller and @aaemnnosttv and this notice was deemed as a "generic" notice and not to enable the "breakdown" of Site Goals widget only - the word "breakdown" here also is meant to refer to the detailed breakdown of metric tiles in terms of authors, categories, etc in Key Metrics and Audience Segmentation too. So in case someone doesn't actually use Site Goals or if they purposely have turned off PCT due to duplicate event tracking or some other plugin override / error, then this would suddenly switch it back on without them needing it. On the Site Goals tab, them asking for the breakdown almost implies that they need PCT.

    And since these are on the same page, the discussion said that it would be funny for the PCT switch to automatically be turned on when someone enables something below!

    I think with #13832, in the event that someone does enable breakdown on the Analytics page and then goes to the Site Goals widget, they will see the new notice to enable PCT. So that will cover all cases.

  14. removed their assignment
    on Oct 13, 2026
  15. kelvinballoo commented on Oct 13, 2026

    @kelvinballoo
    Collaborator

    QA Update ✅

    Thanks for confirming @jimmymadon

    • Key Metrics: An author/category tile was selected in the metrics selection panel and saved, and "Update" was clicked on a tile requiring these custom dimensions (e.g. Top authors, Top categories). All five dimensions were confirmed to be created in GA: googlesitekit_post_date, googlesitekit_post_author, googlesitekit_post_categories, googlesitekit_post_type, googlesitekit_event_provider.

      Details
      13552.-.01.-.Category.author.mov
      13552.-.02.Tiles.update.ok.mov
    • Audience Segmentation: The CTA on the "Top content" tile was clicked. All five dimensions were confirmed to be created.

      Details
      13552.-.03.-.Audience.seg.mov
    • After either CTA, it was confirmed that none of the other custom dimension notices (Key Metrics, Top content, Site Goals) were shown.

    • After the Key Metrics and Audience Segmentation CTAs, Plugin Conversion Tracking was confirmed to be unchanged in Settings → Admin Settings.

    • Site Goals breakdown: * With the dimensions present and conversion tracking enabled, the breakdown was shown automatically and no "Get breakdown" notice was displayed.

      Details
      13552.-.04.-.Breakdown.goes.into.gathering.auto.-.when.dimension.exist.+.conversion.tracking.on.mov
      • With the dimensions present and conversion tracking disabled, the notice was still shown in its conversion tracking variant.
      • The "Get breakdown" CTA and the "Enable" button in Analytics settings → advanced data breakdowns were confirmed to work as before.
      • A CTA was run again with all dimensions already present. It completed without error and no duplicates were created.
      Details
      13552.-.05.-.Get.breakdown.ok.-.no.duplicates.mov
      13552.-.06.-.Enable.breakdown.should.auto.plugin.conversion.as.on.mov
  16. removed their assignment
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Medium priorityTeam SIssues for Squad 1Type: 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