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
GA events should be added to keep track of interaction with the Analytics setup CTA (see #11816).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
The following GA events should be tracked for the given actions. See the GA events sheet.
These changes are only active when the setupFlowRefresh feature flag is enabled.
Event Name
Category
Label
Trigger
Condition
view_cta
{viewContext}_activate-analytics-cta
one of: search_funnel, wp_dashboard, admin_bar
element visibility
user views the Analytics setup CTA in the Search Funnel, WP Dashboard or Admin Bar
confirm_cta
{viewContext}_activate-analytics-cta
one of: search_funnel, wp_dashboard, admin_bar
click
user clicks the "Set up Analytics" button in the CTA
dismiss_cta
{viewContext}_activate-analytics-cta
one of: search_funnel, wp_dashboard, admin_bar
click
user clicks the "Maybe later" button to dismiss the CTA
click_learn_more_link
{viewContext}_activate-analytics-cta
one of: search_funnel, wp_dashboard, admin_bar
click
user clicks on the "Learn more" link in the CTA
_____________________
______________________________________
_____________________________
______________
__________________________________
Implementation Brief
In assets/js/components/ActivateAnalyticsCTA.js:
Accept a new prop, analyticsEventLabel, which is a string. It will be passed to the trackEvents callback functions (returned from useNotificationEvents) as a label if it is not undefined. Pass the label to these functions using the following object structure:
{
label: analyticsEventLabel;}
Use the useNotificationEvents hook, which returns a trackEvents object used to track various events. The following parameters need to be passed to useNotificationEvents:
Add the useMount hook in the component to track the event when the component is first viewed. Call trackEvents.view to track the view_cta action according to the ACs. Pass the arguments to the trackEvents.view function as mentioned above.
Create a new function, handleDismiss, and call trackEvents.dismiss within it. The dismissItem function should also be called afterward, as it is currently assigned to the onClick prop of the "Maybe later" button. Pass the arguments to the trackEvents.dismiss function as mentioned above.
Add an onClick prop to the Link component for the "Learn more" link (which is rendered when the setupFlowRefresh feature is enabled). This should accept a callback function that calls trackEvents.clickLearnMore. Pass the arguments to the trackEvents.clickLearnMore function as mentioned above.
In assets/js/components/adminbar/AdminBarActivateAnalyticsCTA.js:
Add the analyticsEventLabel prop to the AnalyticsCTA component and pass the value admin_bar when the setupFlowRefresh feature is enabled.
In assets/js/components/wp-dashboard/WPDashboardActivateAnalyticsCTA.js:
Add the analyticsEventLabel prop to the AnalyticsCTA component and pass the value wp_dashboard when the setupFlowRefresh feature is enabled.
In assets/js/modules/search-console/components/common/ActivateAnalyticsCTA.js:
Add the analyticsEventLabel prop to the AnalyticsCTA component and pass the value search_funnel when the setupFlowRefresh feature is enabled.
Test Coverage
Update the tests for AdminBarWidgets, SearchFunnelWidgetGA4, and WPDashboardWidgets to verify the tracking events mentioned above.
Set up Site Kit with the setupFlowRefresh feature flag enabled. Don't connect Analytics.
Verify that the GA events are tracked according to AC for Analytics setup CTA which appears in following places.
In searcg console widget on SK dashboard.
Admin dashboard widgets in Dashboard menu of WordPress.
In admin bar on front end.
Changelog entry
Add GA event tracking for user interaction with the Analytics setup CTA.
Feature Description
GA events should be added to keep track of interaction with the Analytics setup CTA (see #11816).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
setupFlowRefreshfeature flag is enabled.Implementation Brief
In
assets/js/components/ActivateAnalyticsCTA.js:Accept a new prop,
analyticsEventLabel, which is a string. It will be passed to thetrackEventscallback functions (returned fromuseNotificationEvents) as alabelif it is notundefined. Pass the label to these functions using the following object structure:Use the
useNotificationEventshook, which returns atrackEventsobject used to track various events. The following parameters need to be passed touseNotificationEvents:id:activate-analytics-ctacategory:undefinedAn
actionsobject as follows:Add the
useMounthook in the component to track the event when the component is first viewed. CalltrackEvents.viewto track theview_ctaaction according to the ACs. Pass the arguments to thetrackEvents.viewfunction as mentioned above.Create a new function,
handleDismiss, and calltrackEvents.dismisswithin it. ThedismissItemfunction should also be called afterward, as it is currently assigned to theonClickprop of the "Maybe later" button. Pass the arguments to thetrackEvents.dismissfunction as mentioned above.Add an
onClickprop to theLinkcomponent for the "Learn more" link (which is rendered when thesetupFlowRefreshfeature is enabled). This should accept a callback function that callstrackEvents.clickLearnMore. Pass the arguments to thetrackEvents.clickLearnMorefunction as mentioned above.In
assets/js/components/adminbar/AdminBarActivateAnalyticsCTA.js:analyticsEventLabelprop to theAnalyticsCTAcomponent and pass the valueadmin_barwhen thesetupFlowRefreshfeature is enabled.In
assets/js/components/wp-dashboard/WPDashboardActivateAnalyticsCTA.js:analyticsEventLabelprop to theAnalyticsCTAcomponent and pass the valuewp_dashboardwhen thesetupFlowRefreshfeature is enabled.In
assets/js/modules/search-console/components/common/ActivateAnalyticsCTA.js:analyticsEventLabelprop to theAnalyticsCTAcomponent and pass the valuesearch_funnelwhen thesetupFlowRefreshfeature is enabled.Test Coverage
AdminBarWidgets,SearchFunnelWidgetGA4, andWPDashboardWidgetsto verify the tracking events mentioned above.Set up Site Kit with the
setupFlowRefreshfeature flag enabled. Don't connect Analytics.Verify that the GA events are tracked according to AC for Analytics setup CTA which appears in following places.
Dashboardmenu of WordPress.Changelog entry