Implement header bar GA events for dashboard sharing
See original GitHub issueBased on the custom GA events defined for dashboard sharing, this issue is focused on implementing the events that are part of the header bar.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- A new GA event should be fired when the user clicks on the “Share” button in the Site Kit header bar:
- Event name:
open_sharing
- Event category:
{viewContext}_headerbar
- Event label: either
simple
(if the site has only one administrator) oradvanced
(if the site has more than one administrator)
- Event name:
- A new GA event should be fired when the user clicks on the “View only” button in the Site Kit header bar:
- Event name:
open_viewonly
- Event category:
{viewContext}_headerbar
- No event label
- Event name:
- A new GA event should be fired when the user clicks on the “Sign in with Google” button (only available for administrators) in the Site Kit header bar’s view only menu:
- Event name:
start_user_setup
- Event category:
{viewContext}_headerbar_viewonly
- Event label: either
proxy
(if site is using the proxy) orcustom-oauth
(if site is not using the proxy)
- Event name:
- A new GA event should be fired when the user opts in to tracking from within the Site Kit header bar’s view only menu:
- Event name:
tracking_optin
- Event category:
{viewContext}_headerbar_viewonly
- No event label
- Event name:
- A new GA event should be fired when the user clicks on the “Learn more” link in the Site Kit header bar’s view only menu:
- Event name:
click_learn_more_link
- Event category:
{viewContext}_headerbar_viewonly
- No event label
- Event name:
Implementation Brief
- In the
DashboardSharingSettingsButton
component:- Get the current view context using the
useViewContext
hook. - Call the
trackEvent( '{viewContext}_headerbar', 'open_sharing' )
function in theopenDialog
callback.
- Get the current view context using the
- In the
assets/js/components/ViewOnlyMenu/index.js
file:- Get the current view context using the
useViewContext
hook. - Update the
toggleMenu
callback to calltrackEvent( '{viewContext}_headerbar', 'open_viewonly' )
function when the current value of themenuOpen
variable is false.
- Get the current view context using the
- In the
assets/js/components/ViewOnlyMenu/Description.js
file:- Update the
onButtonClick
callback to call thetrackEvent
function for thestart_user_setup
event unconditionally.- Update the event category to be
{viewContext}_headerbar_viewonly
. - Add event label that is either
proxy
(if site is using the proxy) orcustom-oauth
(if site is not using the proxy).
- Update the event category to be
- Add a new callback that calls the
trackEvent( '{viewContext}_headerbar_viewonly', 'click_learn_more_link' )
function and set it as theonClick
property to the “learn more” link.
- Update the
- In the
OptIn
component:- Add a new optional property
trackEventCategory
. - Update the
trackEvent
call to use thetrackEventCategory
property if provided, otherwise use the currentviewContext
variable.
- Add a new optional property
- In the
assets/js/components/ViewOnlyMenu/Tracking.js
file:- Get the current view context using the
useViewContext
hook. - Add
trackEventCategory={ '{viewContext}_headerbar_viewonly' }
property to theOptIn
element.
- Get the current view context using the
Test Coverage
- N/A
QA Brief
- Verify that events described in AC are triggered correctly.
Changelog entry
- N/A
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Create and customize Dashboards - Analytics Help
Create your Dashboard · Sign in to Google Analytics. · Navigate to your view. · Open Reports. · Click CUSTOMIZATION > Dashboards. ·...
Read more >How to create a Google Analytics Event Tracking custom report
The report will be added to the Saved Reports area on the left navigation bar. Let's say you want to see the pages...
Read more >Google Analytics Event Tracking Tutorial - Optimize Smart
Google Analytics event tracking allows you to track a specific user's ... Step-1: Navigate to Behavior > Events > Top Events reports of...
Read more >Use these tools to boost Web Stories performance
Boost Web Stories performance with Google Analytics and Data Studio. ... navigating to Behavior > Events > Overview in the navigation bar.
Read more >Track Events with Google Analytics 4 (GA4) and Google Tag ...
By the way, nav means “navigation” in this context. Great! Now I'll use this in my Just Links trigger. Go back to the...
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
Good catch, @wpdarren. No, the event label should be added in this ticket and not depend on 4822. I have created a follow-up PR that adds the label #5304. Once it is reviewed and merged, this issue should be fixed.
@wpdarren looks like we need to wait until #5188 is merged to be able to QA this properly. I am going to assign this to you for now. Please, check it again when that ticket is ready and assign it back to me if this one still doesn’t work for you.