Implement GA events for zero states
See original GitHub issueA few additional GA events for new areas from the zeroDataStates epic should be implemented.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Both the “gathering data” and “zero data” banner notifications should fire GA tracking events for certain interactions (via
ZeroDataStateNotifications):- Any of the events below should use a category depending on which of the two notifications is shown:
- If the
gathering-data-notificationis shown, the category needs to be{viewContext}_gathering-data-notification. - If the
zero-data-notificationis shown, the category needs to be{viewContext}_zero-data-notification.
- If the
- When the respective notification is shown (i.e.
useMount), aview_notificationevent should be fired. - When the respective dismiss button is clicked, a
dismiss_notificationevent should be fired. - When the learn more button is clicked (only relevant for
zero-data-notification), aclick_learn_more_linkevent should be fired.
- Any of the events below should use a category depending on which of the two notifications is shown:
- Two GA tracking events for the new
CreateGoalCTAcomponent should be added:- Both of the events should use
{viewContext}_search-traffic-widgetas category. - When the component is shown (i.e.
useMount), aview_analytics_goal_ctaevent should be fired. - When the user clicks the support link “Create a new goal”, a
click_analytics_goal_ctaevent should be fired.
- Both of the events should use
Implementation Brief
Note: The banner notification events implementation would benefit from building out the two notifications as their own components and keeping the current ZeroDataStateNotifications component only as a wrapper for alternatively displaying one of them.
- Using
assets/js/components/notifications/BannerNotification/index.js,- Add a new prop
onViewwhich will be a function called within theuseMounthook if defined.
- Add a new prop
- Rename and move
assets/js/components/notifications/ZeroDataStateNotifications.jstoassets/js/components/notifications/ZeroDataStateNotifications/index.js. This includesZeroDataStateNotifications.stories.jsas well. - Create
assets/js/components/notifications/ZeroDataStateNotifications/GatheringDataNotification.jswhich exports theGatheringDataNotificationfunctional component.- It should render the same
BannerNotificationfromindex.jshavinggathering-data-notificationasid. - It should accept a
titleprop which will be used as value for thetitleprop ofBannerNotification. - Category for event tracking should be:
{viewContext}_gathering-data-notification. - Add the following props to
BannerNotification:onView: callback function should calltrackEventwith event action set toview_notification.onDismiss: Callback function should calltrackEventwith event action set todismiss_notification.
- It should render the same
- Create
assets/js/components/notifications/ZeroDataStateNotifications/ZeroDataNotification.jswhich exports theZeroDataNotificationfunctional component.- It should render the same
BannerNotificationfromindex.jshavingzero-data-notificationasid. - Category for event tracking should be:
{viewContext}_zero-data-notification. - Add the following props to
BannerNotification:onView: callback function should calltrackEventwith event action set toview_notification.onDismiss: Callback function should calltrackEventwith event action set todismiss_notification.onLearnMoreClick: Callback function should calltrackEventwith event action set toclick_learn_more_link.
- It should render the same
- For the above new components,
- Import the
trackEventfunction fromassets/js/util/tracking/index.js. - Get the context by using the
useContexthook withViewContextContextas parameter.ViewContextContextimported fromassets/js/components/Root/ViewContextContext.js.
- Import the
- Using
assets/js/components/notifications/ZeroDataStateNotifications/index.js,- Replace the
gathering-data-notificationbanner notification with the newGatheringDataNotificationcomponent, passing thegatheringDataTitleas value to thetitleprop. - Replace the
zero-data-notificationbanner notification with the newZeroDataNotificationcomponent. - Tweak the code to return early when we return
GatheringDataNotification, thus avoiding the conditions to displayZeroDataNotification.
- Replace the
- Using
assets/js/modules/search-console/components/dashboard/SearchFunnelWidget/CreateGoalCTA.js,- Import
trackEventand get the context as per the above. - The event category should be
{viewContext}_search-traffic-widgetfor alltrackEventcalls. - Using the
useMounthook, calltrackEventwith event action set toview_analytics_goal_cta. - Add the
onClickprop to theButtoncomponent and callback function should calltrackEventwith event action set toclick_analytics_goal_cta.
- Import
Test Coverage
- No new tests to be added.
QA Brief
- Ensure the GA events are fired as per the AC when the gathering data and zero data notifications are rendered.
- Ensure GA events are fired as per the AC for the CreateGoalCTA
Changelog entry
- N/A
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How can I have more than zero Events, but zero Unique Events?
When I look at my Events Overview, drill down to a specific Event Action, and then add a secondary dimension of Page, I...
Read more >Non-Interaction Events in Google Analytics - Bounteous
Non-interaction events are not taken into account when Google Analytics (GA) calculates bounces and session duration. Conversely, interaction ...
Read more >How to set up event tracking (5:00) - YouTube
This video from Advanced Google Analytics in the Analytics Academy provides an overview for how event tracking works in Google Analytics.
Read more >Google Analytics events · Help Center - Zeroheight
To account for this our platform sends Events to GA whenever someone visits a new "page". There should be page view events being...
Read more >[GA4] Data collection - Analytics Help - Google Support
Google Analytics collects the following information through the default implementation: Number of users; Session statistics; Approximate geolocation ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@felixarntz Totally makes sense! I’ve updated the IB, can you take another look?
Thanks!
@eclarke1 @FlicHollis This needs to be part of the zero data states launch, so I’ve added the sprint and release as needed. It should be a quite small issue though. We can remove something from dashboard sharing if necessary.