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-notification
is shown, the category needs to be{viewContext}_gathering-data-notification
. - If the
zero-data-notification
is shown, the category needs to be{viewContext}_zero-data-notification
.
- If the
- When the respective notification is shown (i.e.
useMount
), aview_notification
event should be fired. - When the respective dismiss button is clicked, a
dismiss_notification
event should be fired. - When the learn more button is clicked (only relevant for
zero-data-notification
), aclick_learn_more_link
event 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
CreateGoalCTA
component should be added:- Both of the events should use
{viewContext}_search-traffic-widget
as category. - When the component is shown (i.e.
useMount
), aview_analytics_goal_cta
event should be fired. - When the user clicks the support link “Create a new goal”, a
click_analytics_goal_cta
event 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
onView
which will be a function called within theuseMount
hook if defined.
- Add a new prop
- Rename and move
assets/js/components/notifications/ZeroDataStateNotifications.js
toassets/js/components/notifications/ZeroDataStateNotifications/index.js
. This includesZeroDataStateNotifications.stories.js
as well. - Create
assets/js/components/notifications/ZeroDataStateNotifications/GatheringDataNotification.js
which exports theGatheringDataNotification
functional component.- It should render the same
BannerNotification
fromindex.js
havinggathering-data-notification
asid
. - It should accept a
title
prop which will be used as value for thetitle
prop ofBannerNotification
. - Category for event tracking should be:
{viewContext}_gathering-data-notification
. - Add the following props to
BannerNotification
:onView
: callback function should calltrackEvent
with event action set toview_notification
.onDismiss
: Callback function should calltrackEvent
with event action set todismiss_notification
.
- It should render the same
- Create
assets/js/components/notifications/ZeroDataStateNotifications/ZeroDataNotification.js
which exports theZeroDataNotification
functional component.- It should render the same
BannerNotification
fromindex.js
havingzero-data-notification
asid
. - Category for event tracking should be:
{viewContext}_zero-data-notification
. - Add the following props to
BannerNotification
:onView
: callback function should calltrackEvent
with event action set toview_notification
.onDismiss
: Callback function should calltrackEvent
with event action set todismiss_notification
.onLearnMoreClick
: Callback function should calltrackEvent
with event action set toclick_learn_more_link
.
- It should render the same
- For the above new components,
- Import the
trackEvent
function fromassets/js/util/tracking/index.js
. - Get the context by using the
useContext
hook withViewContextContext
as parameter.ViewContextContext
imported fromassets/js/components/Root/ViewContextContext.js
.
- Import the
- Using
assets/js/components/notifications/ZeroDataStateNotifications/index.js
,- Replace the
gathering-data-notification
banner notification with the newGatheringDataNotification
component, passing thegatheringDataTitle
as value to thetitle
prop. - Replace the
zero-data-notification
banner notification with the newZeroDataNotification
component. - 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
trackEvent
and get the context as per the above. - The event category should be
{viewContext}_search-traffic-widget
for alltrackEvent
calls. - Using the
useMount
hook, calltrackEvent
with event action set toview_analytics_goal_cta
. - Add the
onClick
prop to theButton
component and callback function should calltrackEvent
with 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.