Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look to implement page on-event tracking for google analytics to provide customer insights for Clima sub-pages #151

Open
danielh7-cs9 opened this issue Mar 17, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request High Priority This is High Priority!

Comments

@danielh7-cs9
Copy link
Contributor

Is your feature request related to a problem? Please describe.
No relation to a problem, feature enhancement to allow greater user insights into clima pages used.

Describe the solution you'd like
When Clima sub-page is loaded, create event to google analytics

@danielh7-cs9 danielh7-cs9 self-assigned this Mar 17, 2023
@danielh7-cs9 danielh7-cs9 added the enhancement New feature or request label Mar 17, 2023
@FedericoTartarini FedericoTartarini added the High Priority This is High Priority! label Mar 17, 2023
@danielh7-cs9
Copy link
Contributor Author

There a couple of ways to do this, but based on my research so far we may need to create additional GTMs and have the js called for certain functions.e.g when user clicks on tab.

Some initial research so far - https://community.plotly.com/t/using-google-analytics-with-dash-app/62347

@danielh7-cs9
Copy link
Contributor Author

danielh7-cs9 commented Apr 7, 2023

I've managed to get tracking on each of the clima subpages on my test clima by using Google tag manager.

For each GTM tag, there is an 'on-click' trigger which matches the html click text for each tab. Example below.

image

Each trigger is assigned to a specific GA4 GTM event tag.

image

As users view each tab, each tag is fired and reported back into GA4 dashboards. See below.

image

@danielh7-cs9
Copy link
Contributor Author

Hey @FedericoTartarini, please see above for what I've implemented in my non-prod clima. I am able to gather tracking of each clima tabs/pages using triggers and mapping them to GTM events. Let me know if you think/want this implemented in production Clima.

@FedericoTartarini
Copy link
Contributor

It looks great, you can show me this during our next meeting

@danielh7-cs9
Copy link
Contributor Author

danielh7-cs9 commented Apr 17, 2023

Hey @FedericoTartarini, I think I found a more elegant way of doing this with GTM with pulling from the datalayer directly.

I created a trigger to track click and fire when the class = "jsx-4020002479".

image

Note - my original plan was to match using CCS selector but I've tried many ways to match the code including Regex and it just wont fire.
image

Instead of an individual GTM tag per tab (in red below), we create one and configure the event parameters to return the click value from the datalayer {{Click Text}}
image

image

This means if you were to add new tabs to Clima, you wouldn't need to setup a new tag (assuming the trigger conditions the same).

Below are the event counts pushed into GA4.

image

There only cons I do not like with the above is:

  1. At the moment I am matching using a class which seems to be generated from React. I'll see if I am able to use the CCS Selector correctly.
    image
  2. It is tracking the Select Weather tab but I don't think it is that much of a concern

@danielh7-cs9
Copy link
Contributor Author

Trigger conditions using the Click element with CCS Selector is now working. The tag is firing with a conditional match on div id "tabs" nested elements using #tabs *

image

image

This will be the best approach for condition matching as the div id is defined statically in layout.py.
image

@t-kramer t-kramer assigned t-kramer and unassigned t-kramer and danielh7-cs9 Mar 21, 2024
@t-kramer
Copy link

@FedericoTartarini It would be valuable to get this up and running asap. I'll look into this.

@FedericoTartarini
Copy link
Contributor

@t-kramer to implement this properly we need to change the code of clima and make sure that when a person clicks on a tab then the URL changes. To do so you will need to follow this guide https://dash.plotly.com/urls

t-kramer added a commit that referenced this issue May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request High Priority This is High Priority!
Projects
None yet
Development

No branches or pull requests

3 participants