Repository navigation
Standardise custom dimension creation across the Key Metrics, Audience Segmentation and Site Goals notices #13552
Description
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_categoriesandgooglesitekit_post_type. - Audience Segmentation — the "Top content" tile CTA creates only
googlesitekit_post_type, and it bypasses the sharedcreateCustomDimensionsaction entirely, callingfetchCreateCustomDimensiondirectly. - 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
- Accepting any of the three "Site Kit requires custom dimensions" CTAs creates every dimension required by Site Kit on the selected Analytics property, not just the subset that the notice in question needs:
- the Key Metrics metrics selection panel notice, on save;
- the Key Metrics per-tile "Update" CTA;
- the Audience Segmentation "Top content" tile CTA;
- the Site Goals "Get breakdown" CTA (already the case; behaviour must not regress);
- the "Enable" button in the Analytics settings advanced data breakdowns section (already the case; behaviour must not regress).
- Dimensions that already exist are not recreated, and a CTA with nothing left to create should still complete without error.
- After accepting any one CTA, none of the other custom dimension notices are shown.
- The Key Metrics and Audience Segmentation CTAs leave Plugin Conversion Tracking unchanged.
- The Site Goals breakdown state is automatically enabled without the "Get breakdown" notice if the breakdown custom dimensions exist and Plugin Conversion Tracking is enabled.
- While either is missing, the appropriate notice or variant added in Enable Plugin Conversion Tracking from the Site Goals breakdown CTA with a disclosure variant of the notice #13398 is shown and its CTA informs the user of the missing part. A site that gained the dimensions from another CTA but has conversion tracking off keeps seeing the notice.
Implementation Brief
- Update
assets/js/modules/analytics-4/datastore/constants.ts- Rename
SITE_GOALS_CUSTOM_DIMENSIONStoALL_CUSTOM_DIMENSIONS, keeping itsObject.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).
- Rename
- Update
assets/js/modules/analytics-4/datastore/custom-dimensions.js- In
createCustomDimensions, replace the required-dimension computation withALL_CUSTOM_DIMENSIONS: drop theKEY_METRICS_WIDGETSlookup overgetKeyMetrics(), the deduplication, and theisAdvancedDataBreakdownsEnabledgate that currently decides whether the Site Goals dimensions are included. - Drop the now-unused
customDimensionsparameter and thegetKeyMetricsSettings,getUserInputSettingsandgetAdvancedDataBreakdownsSettingsawaits at the top of the action, keeping only thegetSettingsawait needed forgetPropertyID(). - Leave the rest of the action as is: the
getCustomDimensions( propertyID )read, the missing-dimension filter, thereceiveIsCustomDimensionGatheringDatacall per created dimension, and thefetchSyncAvailableCustomDimensionsat the end. - Add an
@since n.e.x.tline 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
advancedDataBreakdownsflag —SettingsAdvancedDataBreakdownsonly readshasAllCustomDimensionsfor its display state. Leave the setting in place here; retiring it is a separate clean-up.
- In
- 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 localALL_CUSTOM_DIMENSIONSconstant and import the shared one from the datastore constants for itsinProgressselector and itsFORM_CUSTOM_DIMENSIONS_CREATEform value.assets/js/modules/analytics-4/components/site-goals/goal-drivers/TopAuthorsGoalDriver.tsx— keepTOP_AUTHORS_REQUIRED_CUSTOM_DIMENSIONSfor the "which dimension am I waiting on" selectors, but stop passing it tocreateCustomDimensions.assets/js/modules/analytics-4/components/site-goals/selection-panel/CustomDimensionsNotice.tsx— same:requiredCustomDimensionsstill driveshasCustomDimensionsand the busy state, but not the creation call.assets/js/modules/analytics-4/hooks/useCreateCustomDimensionsEffect.js— keep reading thecustomDimensionsform value as thehasExplicitCustomDimensionsgate for the OAuth-return auto-submit, but callcreateCustomDimensions()without it.
- Update
assets/js/modules/analytics-4/hooks/useCreateCustomDimensionForAudienceEffect.js- Replace the
fetchCreateCustomDimension( propertyID, CUSTOM_DIMENSION_DEFINITIONS.googlesitekit_post_type ),receiveIsCustomDimensionGatheringDataandfetchSyncAvailableCustomDimensionssequence with a singleawait createCustomDimensions(); the action already does all three for each missing dimension. propertyIDis no longer read here, since the action resolves it itself.
- Replace the
- Update
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/hooks/useCreateCustomDimension.ts- Make
isCreatingCustomDimensiontrue while any dimension inALL_CUSTOM_DIMENSIONSis being created, instead of onlygooglesitekit_post_type. - In
onCancel, clear thecreateCustomDimensionaction error for every dimension inALL_CUSTOM_DIMENSIONS, not onlygooglesitekit_post_type.
- Make
- Update
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/CustomDimensionErrorModal.tsx- Pass the errors for all of
ALL_CUSTOM_DIMENSIONStoAudienceErrorModal'sapiErrors, filtered to those that are set, rather than the singlegooglesitekit_post_typeerror.
- Pass the errors for all of
- Update
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTile/AudienceTilePagesMetric.jshasMissingCustomDimensionkeeps checkinggooglesitekit_post_typeonly — that is the dimension this tile reports on — butcustomDimensionError, which drivesshouldShowErrorModal, should be true for a failure on any ofALL_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 requireisConversionTrackingEnabled()fromCORE_SITE:assets/js/modules/analytics-4/components/site-goals/hooks/useSiteGoalsBreakdown.tsx— and update the comment abovehasBreakdownDimension, 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 intohasBreakdownDimensions/getBreakdownDimensionStateso 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 readsisConversionTrackingEnabledin 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.tsxandassets/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()readsundefined, 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—createCustomDimensionscreates 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—isSavingcovers any dimension being created, andonCancelclears the error for every dimension.KeyMetrics/MetricsSelectionPanel/index.test.jsandutils/withCustomDimensions.test.js— both Key Metrics CTAs create every dimension and leave plugin conversion tracking unchanged.useSiteGoalsBreakdown.test.tsxandBreakdownNoticeArea.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.tsxandSiteGoalsSurveyTriggers.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.
- 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. - Audience Segmentation: Click the CTA on the "Top content" tile. Check that all five dimensions are created.
- After either CTA, check that none of the other custom dimension notices show (Key Metrics, Top content, Site Goals).
- After the Key Metrics or Audience Segmentation CTA, check that Plugin Conversion Tracking is unchanged in Settings → Admin Settings.
- 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.
- 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
tofumatt commentedon Sep 23, 2026
IB ✅
kelvinballoo commentedon Oct 8, 2026
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:
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
jimmymadon commentedon Oct 12, 2026
@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
kelvinballoo commentedon Oct 12, 2026
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
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?
jimmymadon commentedon Oct 13, 2026
@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.
kelvinballoo commentedon Oct 13, 2026
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
Details
13552.-.05.-.Get.breakdown.ok.-.no.duplicates.mov
13552.-.06.-.Enable.breakdown.should.auto.plugin.conversion.as.on.mov