You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user clicks the primary "Enable" CTA on the "New" notice in a Site Goals widget (implemented in #12800), the existing Site Kit infrastructure for creating custom dimensions should be triggered. This will conditionally initiate an OAuth flow (if property edit permissions have not previously been granted) and then use the existing create-custom-dimension and sync-custom-dimensions routes to create all custom dimensions required by Site Kit — not just the two new ones introduced for Site Goals.
Depending on the outcome of the creation attempt, either a success or error notice should be rendered in place of the "New" notice within the widget. The same flow and result notices should also apply when triggered from the Site Goals Side Panel. See Figma mocks and the Design Doc for full context.
Acceptance criteria
When the user clicks the primary CTA on the "New" notice (in either a Site Goals widget or the Site Goals Side Panel):
If the Analytics property edit scope has not been granted, the OAuth flow should be initiated first.
Once permissions are confirmed, all Site Kit custom dimensions should be created using existing infrastructure - not only the Site Goals-specific ones.
On success:
A success notice replaces the "New" notice only where the CTA was triggered (widget or side panel). The other location should render neither the "New" nor the success notice. (Figma – Lead, Figma – Ecommerce). Also for in side panel notice
On error:
An error notice replaces the "New" notice in both locations (widget and side panel) with a retry option.
Two error variants: a generic creation failure error and a permissions-specific error with adapted wording.
Shared hook used by both the widget notice and the side panel notice
Accepts an origin parameter ('widget' or 'panel') and returns the handler function plus loading/disabled state
On invocation, set FORM_CUSTOM_DIMENSIONS_CREATE with customDimensions containing all keys and breakdownOrigin set to the origin value
If the Analytics edit scope is not granted: also set autoSubmit: true, call snapshotAllStores, then trigger setPermissionScopeError with EDIT_SCOPE and a redirectURL containing notification=site_goals_breakdown. Follow the same pattern as CustomDimensionsNotice.tsxonSetupClick
If the scope is already granted: call createCustomDimensions directly with all dimensions. On completion, set breakdownCreationComplete: true in FORM_CUSTOM_DIMENSIONS_CREATE
Use the existing Notice component with NOTICE_TYPES.ERROR
Accept an onRetry prop for the retry CTA button and an error prop
Handle two variants, distinguished via isInsufficientPermissionsError on the error object:
Generic error: title along the lines of "Analytics update failed" (consistent with AnalyticsUpdateError), description along the lines of "There was a problem updating your Analytics property", with a "Retry" CTA and a troubleshooting link via getErrorTroubleshootingLinkURL
Orchestrator component that accepts an origin prop ('widget' or 'panel') and decides which single notice to render, or none
Reads hasCustomDimensions for all keys in CUSTOM_DIMENSION_DEFINITIONS from MODULES_ANALYTICS_4
Reads in-session creation state from MODULES_ANALYTICS_4: isCreatingCustomDimension for each dimension, isSyncingAvailableCustomDimensions, and getCreateCustomDimensionError for each dimension
Reads breakdownOrigin and breakdownCreationComplete from FORM_CUSTOM_DIMENSIONS_CREATE
Calls useBreakdownEnableHandler with the origin and passes the handler/loading state to the relevant notice
Rendering logic (first matching rule wins):
Error notice: when any getCreateCustomDimensionError returns an error - render BreakdownErrorNotice in both widget and panel regardless of origin
Success notice: when breakdownCreationComplete is true, no creation errors exist, and breakdownOrigin matches this component's origin prop - render BreakdownSuccessNotice
After the existing createDimensionsAndUpdateForm completes, check if breakdownOrigin is set in FORM_CUSTOM_DIMENSIONS_CREATE. If so, set breakdownCreationComplete: true in the same form. This ensures the orchestrator can detect success after the OAuth return path
After creation completes with breakdownOrigin in form, breakdownCreationComplete is set to true
Update assets/js/modules/analytics-4/components/site-goals/widgets/LeadGenerationPerformanceWidget.test.tsx and OnlineStorePerformanceWidget.test.tsx:
BreakdownNoticeArea renders in the correct position within the widget
Add/update Storybook stories for BreakdownSuccessNotice, BreakdownErrorNotice, and BreakdownNoticeArea showing each state (new, loading, success, generic error, permissions error)
QA Brief
Key Setup Helpers
Remove Analytics edit scope (to force OAuth path) without resetting the plugin — run in browser console:
Force a creation error: use a response-override extension (e.g. Tweak, Requestly) to intercept POST on */wp-json/google-site-kit/v1/modules/analytics-4/data/create-custom-dimension?.* and return:
Generic error: HTTP 500, body {"code":"internal_server_error","message":"x","data":{"status":500}}
Permissions error: HTTP 403, body {"code":"insufficient_permissions","message":"x","data":{"status":403,"reason":"insufficientPermissions"}}
"New" Copy Variants
Online Store with both WooCommerce and Easy Digital Downloads active displays: "Using both WooCommerce and Easy Digital Downloads…"
Only one of the two plugins active displays: "See exactly which plugins are driving your results…"
CTA — Direct Create (Edit Scope Granted)
Click "Get breakdown" > CTA shows a spinner and is disabled (can't be re-clicked).
On success > a single success notice appears only at the clicked location (origin + that goal type). E.g. clicking the Online Store widget shows success only there - not in the Lead widget, not in the panel.
All missing Site Kit custom dimensions get created (not only the breakdown ones). You can verify them under analytics property > admin > custom definitions
CTA — OAuth Path (Edit Scope Removed via Snippet Above or on a fresh installataion or after SK reset)
Click "Get breakdown" > notice stays visible in loading state (spinner, not disappearing) through the redirect.
After granting access, the dashboard scrolls back to the Site Goals widget section.
After return, creation runs and the success notice shows at the originating location.
Success Notice
Title/body match the goal type (ecommerce vs lead) per Figma; "Got it" dismisses it.
After "Got it", nothing reappears that session; on reload with dimensions present > nothing shows.
Error Notices (Use Response Override Above)
Generic error displays: "Analytics update failed" + "Learn more" link + Retry + Got it.
Error appears at every eligible section (whose dimension is still missing) in both widget and Side Panel.
Retry re-runs creation (loading > success if the override is removed).
"Got it" dismisses the error for the session; on reload the "New" notice reappears (creation truly failed > dimensions still missing).
Reload Semantics (State is In-Session Only)
After an error + reload > "New" notice reappears.
After success + reload > nothing (dimensions exist).
Out-of-Band Detection
With a breakdown dimension created, delete it directly in GA4, then log out/in and go back to SK dashboard/Site Goals section or come back within ~a day the "New" notice reappears.
Note: Sync is not instant — runs at most once per day, so it will be cached and deleting custom dimensions does not reflect instantly to avoid too many API calls.
Widget - Side Panel Parity
All of the above behaves consistently whether triggered from a widget or from the corresponding Side Panel section.
Users with pre-existing custom dimensions (e.g. created via Key Metrics) but without the breakdown dimensions still see "New" notice.
Changelog entry
Allow creation of custom Site Goals dimensions from notices.
Feature Description
When a user clicks the primary "Enable" CTA on the "New" notice in a Site Goals widget (implemented in #12800), the existing Site Kit infrastructure for creating custom dimensions should be triggered. This will conditionally initiate an OAuth flow (if property edit permissions have not previously been granted) and then use the existing
create-custom-dimensionandsync-custom-dimensionsroutes to create all custom dimensions required by Site Kit — not just the two new ones introduced for Site Goals.Depending on the outcome of the creation attempt, either a success or error notice should be rendered in place of the "New" notice within the widget. The same flow and result notices should also apply when triggered from the Site Goals Side Panel. See Figma mocks and the Design Doc for full context.
Acceptance criteria
assets/js/components/Notice/index.js)Implementation Brief
Add
assets/js/modules/analytics-4/hooks/useBreakdownEnableHandler.jsFORM_CUSTOM_DIMENSIONS_CREATEwith customDimensions containing all keys andbreakdownOriginset to theoriginvalueautoSubmit: true, callsnapshotAllStores, then triggersetPermissionScopeErrorwithEDIT_SCOPEand a redirectURL containingnotification=site_goals_breakdown. Follow the same pattern asCustomDimensionsNotice.tsxonSetupClickcreateCustomDimensionsdirectly with all dimensions. On completion, setbreakdownCreationComplete: trueinFORM_CUSTOM_DIMENSIONS_CREATEAdd
assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownSuccessNotice.tsxNOTICE_TYPES.SUCCESSAdd
assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownErrorNotice.tsxNOTICE_TYPES.ERRORonRetryprop for the retry CTA button and an error propisInsufficientPermissionsErroron the error object:AnalyticsUpdateError), description along the lines of "There was a problem updating your Analytics property", with a "Retry" CTA and a troubleshooting link viagetErrorTroubleshootingLinkURLAdd
assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownNoticeArea.tsxhasCustomDimensionsfor all keys inCUSTOM_DIMENSION_DEFINITIONSfromMODULES_ANALYTICS_4MODULES_ANALYTICS_4:isCreatingCustomDimensionfor each dimension,isSyncingAvailableCustomDimensions, andgetCreateCustomDimensionErrorfor each dimensionbreakdownOriginandbreakdownCreationCompletefromFORM_CUSTOM_DIMENSIONS_CREATEuseBreakdownEnableHandlerwith the origin and passes the handler/loading state to the relevant noticegetCreateCustomDimensionErrorreturns an error - renderBreakdownErrorNoticein both widget and panel regardless of originbreakdownCreationComplete is true, no creation errors exist, andbreakdownOriginmatches this component's origin prop - renderBreakdownSuccessNoticeBreakdownNoticefrom Show 'New' notice CTA in Site Goals widgets to enable custom dimension breakdown #12800 with its primary CTA wired to the enable handlerUpdate
assets/js/modules/analytics-4/hooks/useCreateCustomDimensionsEffect.jscreateDimensionsAndUpdateFormcompletes, check ifbreakdownOriginis set inFORM_CUSTOM_DIMENSIONS_CREATE. If so, setbreakdownCreationComplete: truein the same form. This ensures the orchestrator can detect success after the OAuth return pathUpdate
assets/js/modules/analytics-4/components/site-goals/widgets/LeadGenerationPerformanceWidget.tsxBreakdownNoticeAreawith origin="widget" following the placement from FigmaUpdate
assets/js/modules/analytics-4/components/site-goals/widgets/OnlineStorePerformanceWidget.tsxLeadGenerationPerformanceWidgetIntegrate
BreakdownNoticeAreawith origin="panel" in the Site Goals selection panelCustomDimensionsNoticein the panelTest Coverage
Add tests for
assets/js/modules/analytics-4/hooks/useBreakdownEnableHandler.test.js:createCustomDimensionsdirectly with all dimension keys when scope is presentAdd tests for
assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownSuccessNotice.test.tsx:Add tests for
assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownErrorNotice.test.tsx:Add tests for
assets/js/modules/analytics-4/components/site-goals/notifications/BreakdownNoticeArea.test.tsx:BreakdownSuccessNoticeat origin location only after creation completesBreakdownErrorNotice(generic) in both locations on creation failureBreakdownErrorNotice(permissions) in both locations on insufficient permissions errorUpdate
assets/js/modules/analytics-4/hooks/useCreateCustomDimensionsEffect.test.js:Update
assets/js/modules/analytics-4/components/site-goals/widgets/LeadGenerationPerformanceWidget.test.tsxandOnlineStorePerformanceWidget.test.tsx:BreakdownNoticeArearenders in the correct position within the widgetAdd/update Storybook stories for
BreakdownSuccessNotice,BreakdownErrorNotice, andBreakdownNoticeAreashowing each state (new, loading, success, generic error, permissions error)QA Brief
Key Setup Helpers
POSTon*/wp-json/google-site-kit/v1/modules/analytics-4/data/create-custom-dimension?.*and return:{"code":"internal_server_error","message":"x","data":{"status":500}}{"code":"insufficient_permissions","message":"x","data":{"status":403,"reason":"insufficientPermissions"}}"New" Copy Variants
CTA — Direct Create (Edit Scope Granted)
CTA — OAuth Path (Edit Scope Removed via Snippet Above or on a fresh installataion or after SK reset)
Success Notice
Error Notices (Use Response Override Above)
Reload Semantics (State is In-Session Only)
Out-of-Band Detection
Widget - Side Panel Parity
Changelog entry