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
The Site Goals widgets are useful to tell a story of the entire funnel (form completion or product purchase). As such, these widgets are not helpful if we can't provide a tabbed breakdown of the "lead generation" and "purchase" events by Plugin source or Form titles. The breakdown can only be enabled if we are certain that Site Kit has the potential to track events (with a custom dimension for plugin source and form ID) for a site using the Plugin Conversion Reporting feature. So we should not enable the widget if a corresponding event provider plugin is not active. See this Design Doc section.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
If the Site Goals widget has not been rendered before (i.e. no events were detected initially), then the initial rendering of each widget should now also depend on their corresponding event provider plugin should be active.
For the Lead Generation widget to be shown: At least one of the “Lead generation” event provider plugins should be installed, viz. Contact Form 7, Mailchimp, Ninja Forms, Optin Monster, Popup Maker or WPForms.
For the Online Store Performance widget to be shown: At least one of the “E-commerce” event provider plugins should be active, viz. WooCommerce or Easy Digital Downloads.
In effect, the above widgets should not be rendered (and if both are not rendered, then the whole Site Goals widget area and navigation chip should be hidden) if the above conditions are not met.
Implementation Brief
In Conversion_Tracking, hook into googlesitekit_inline_base_data filter to provide active provider category flags
Follow the same pattern used by Consent_Mode which adds consentModeRegions via this filter
Add an inline_js_base_data method that receives the existing inline data array and appends two boolean values:
hasActiveLeadEventProviders — true if any lead-category provider (Contact Form 7, WPForms, Ninja Forms, Mailchimp, OptinMonster, Popup Maker) is active
hasActiveEcommerceEventProviders — true if any ecommerce-category provider (WooCommerce, Easy Digital Downloads) is active
Derive both by intersecting array_keys() of get_active_providers() against a hard-coded list of lead/ecommerce slugs from the respective provider classes' CONVERSION_EVENT_PROVIDER_SLUG constants
Update the CORE_SITEinfo.js datastore to consume the two new properties
In the getSiteInfo resolver, destructure hasActiveLeadEventProviders and hasActiveEcommerceEventProviders from global._googlesitekitBaseData and pass them through to receiveSiteInfo()
Add corresponding initial state entries (default false)
Expose via getSiteInfoProperty() selectors, following the pattern of existing boolean properties like isMultisite and webStoriesActive
Add isActive callbacks to both Site Goals widget registrations in the analytics-4 widgets index.js
For the analyticsOnlineStorePerformance widget, use the new CORE_SITE selector to check hasActiveEcommerceEventProviders
For the analyticsLeadGenerationPerformance widget, use the selector to check hasActiveLeadEventProviders
The existing widget visibility chain handles the rest automatically: when both widgets are inactive, isWidgetAreaActive returns false for the Site Goals area, isWidgetContextActive returns false, and the navigation chip is hidden via useVisibleSections
Note: the widgets already return WidgetNullComponent internally when no events are detected — the isActive callback provides an earlier gate at registration level so the widget/area/chip never render at all when the provider plugin is not installed
Test Coverage
Add tests for the new inline_js_base_data method on Conversion_Tracking - verify that the correct boolean flags are returned based on which provider plugins are active (mock the is_active() checks via defined constants)
Add tests for the new CORE_SITE selectors to verify they correctly surface values from site info state
Update widget registration tests to verify that isActive callbacks correctly gate the Site Goals widgets based on the CORE_SITE selector values
QA Brief
Setup SK with siteGoals feature flag
Go to Tester Settings -> Analytics -> Conversion reporting
Under detected events, choose ecommerce event, example purchase
Install And Activate WooCommerce or Easy Digital Downloads plugin
Verify that on Dashboard SIte Goals widget for ecommerce is showing
Deactivate WooCommerce -> Verify site goals widget for ecommerce is not showing
Repeat step 1 from previous use case, and choose contact event
Install and activate any supported lead plugin, like Contact Form 7
Verify that Site Goals widget for leads is showing in dashboard
Deactivate the plugin -> Verify that leads widget is not showing in dashboard
Changelog entry
Update Site Goals widgets not to show up if no event provider plugins are activated.
Feature Description
The Site Goals widgets are useful to tell a story of the entire funnel (form completion or product purchase). As such, these widgets are not helpful if we can't provide a tabbed breakdown of the "lead generation" and "purchase" events by Plugin source or Form titles. The breakdown can only be enabled if we are certain that Site Kit has the potential to track events (with a custom dimension for plugin source and form ID) for a site using the Plugin Conversion Reporting feature. So we should not enable the widget if a corresponding event provider plugin is not active. See this Design Doc section.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
In
Conversion_Tracking, hook intogooglesitekit_inline_base_datafilter to provide active provider category flagsConsent_Modewhich addsconsentModeRegionsvia this filterinline_js_base_datamethod that receives the existing inline data array and appends two boolean values:hasActiveLeadEventProviders—trueif any lead-category provider (Contact Form 7, WPForms, Ninja Forms, Mailchimp, OptinMonster, Popup Maker) is activehasActiveEcommerceEventProviders—trueif any ecommerce-category provider (WooCommerce, Easy Digital Downloads) is activearray_keys()ofget_active_providers()against a hard-coded list of lead/ecommerce slugs from the respective provider classes'CONVERSION_EVENT_PROVIDER_SLUGconstantsUpdate the
CORE_SITEinfo.jsdatastore to consume the two new propertiesgetSiteInforesolver, destructurehasActiveLeadEventProvidersandhasActiveEcommerceEventProvidersfromglobal._googlesitekitBaseDataand pass them through toreceiveSiteInfo()false)getSiteInfoProperty()selectors, following the pattern of existing boolean properties likeisMultisiteandwebStoriesActiveAdd
isActivecallbacks to both Site Goals widget registrations in the analytics-4 widgetsindex.jsanalyticsOnlineStorePerformancewidget, use the newCORE_SITEselector to checkhasActiveEcommerceEventProvidersanalyticsLeadGenerationPerformancewidget, use the selector to checkhasActiveLeadEventProvidersisWidgetAreaActivereturnsfalsefor the Site Goals area,isWidgetContextActivereturnsfalse, and the navigation chip is hidden viauseVisibleSectionsWidgetNullComponentinternally when no events are detected — theisActivecallback provides an earlier gate at registration level so the widget/area/chip never render at all when the provider plugin is not installedTest Coverage
inline_js_base_datamethod onConversion_Tracking- verify that the correct boolean flags are returned based on which provider plugins are active (mock theis_active()checks via defined constants)CORE_SITEselectors to verify they correctly surface values from site info stateisActivecallbacks correctly gate the Site Goals widgets based on theCORE_SITEselector valuesQA Brief
siteGoalsfeature flagpurchasecontacteventChangelog entry