question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement header bar GA events for dashboard sharing

See original GitHub issue

Based 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) or advanced (if the site has more than one administrator)
  • 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
  • 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) or custom-oauth (if site is not using the proxy)
  • 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
  • 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

Implementation Brief

  • In the DashboardSharingSettingsButton component:
    • Get the current view context using the useViewContext hook.
    • Call the trackEvent( '{viewContext}_headerbar', 'open_sharing' ) function in the openDialog callback.
  • In the assets/js/components/ViewOnlyMenu/index.js file:
    • Get the current view context using the useViewContext hook.
    • Update the toggleMenu callback to call trackEvent( '{viewContext}_headerbar', 'open_viewonly' ) function when the current value of the menuOpen variable is false.
  • In the assets/js/components/ViewOnlyMenu/Description.js file:
    • Update the onButtonClick callback to call the trackEvent function for the start_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) or custom-oauth (if site is not using the proxy).
    • Add a new callback that calls the trackEvent( '{viewContext}_headerbar_viewonly', 'click_learn_more_link' ) function and set it as the onClick property to the “learn more” link.
  • In the OptIn component:
    • Add a new optional property trackEventCategory.
    • Update the trackEvent call to use the trackEventCategory property if provided, otherwise use the current viewContext variable.
  • 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 the OptIn element.

Test Coverage

  • N/A

QA Brief

  • Verify that events described in AC are triggered correctly.

Changelog entry

  • N/A

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
eugene-manuilovcommented, May 31, 2022

@eugene-manuilov just one observation. When I click on the ‘Sharing settings’ icon in the header bar, all of the AC passes other than Event label: either simple (if the site has only one administrator) or advanced (if the site has more than one administrator) is not appearing in the GA data. Could this because we still have 4822 in Execution?

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.

1reaction
eugene-manuilovcommented, May 26, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found