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

Update GA tracking codes #556

Open
fgregg opened this issue Nov 1, 2021 · 11 comments
Open

Update GA tracking codes #556

fgregg opened this issue Nov 1, 2021 · 11 comments
Assignees

Comments

@fgregg
Copy link
Member

fgregg commented Nov 1, 2021

GTM Code:

Paste this code as high in the <head> of the page as possible:

    <!-- Google Tag Manager -->

    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':

    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

    })(window,document,'script','dataLayer','GTM-KDVKMFP');</script>

    <!-- End Google Tag Manager -->

Additionally, paste this code immediately after the opening <body> tag:

    <!-- Google Tag Manager (noscript) -->

    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KDVKMFP"

    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

    <!-- End Google Tag Manager (noscript) -->

Measurement ID:G-03X4F5LNXG

you will probably need to take out the current UA-based tracking code.

@fgregg
Copy link
Member Author

fgregg commented Nov 1, 2021

@smcalilly you should have access to the BGA properties on https://analytics.google.com

so you should be able confirm that code has gotten set up correctly.

LMK if you have any questions about this.

@smcalilly
Copy link
Contributor

@fgregg i have two questions:

  1. will i be able to test this locally or does it need to deploy to a specific domain in order to be tracked in google analytics?
  2. you said:

you will probably need to take out the current UA-based tracking code.

so with this change, will i also need to reconfigure the existing tracking code to work with this new tracking code?

@smcalilly
Copy link
Contributor

i might've found an answer to question number 2. it looks like it's A Thing to migrate to google tag manager from google analytics. see this blog post and find the section Google Tag Manager vs Google Analytics: Events: https://www.analyticsmania.com/post/google-tag-manager-vs-google-analytics/

another blog post about migrating: https://threeventures.com/what-is-google-tag-manager-how-to-migrate-to-it-and-best-practices/

@fgregg
Copy link
Member Author

fgregg commented Nov 2, 2021

  1. yes. as long as you have adtracking and privacy plugins turned off, then local browsing should trigger the events and show up in the google analytics
  2. yes, as you have found out. let me know if you need further help with this.

@smcalilly
Copy link
Contributor

@fgregg where am i supposed to see my localhost traffic? here's a gif where i'm searching for it and not seeing it (with adblocker turned off):
analytics-localhost

live site

for reference, here's a gif of me doing a similar analytic search on the live site and seeing my traffic:
analytics-live-site

@fgregg
Copy link
Member Author

fgregg commented Nov 5, 2021

do you have the same code running on staging and local?

@smcalilly
Copy link
Contributor

i think so? locally, i'm using the latest changes from master. and not using the google tag manager code.

@smcalilly
Copy link
Contributor

this google tag manager documentation suggests that we'll need to configure analytics in the google tag manager admin site and not google analytics. does that sound right? if so, we'll need access to the tag manager site.

@fgregg
Copy link
Member Author

fgregg commented Nov 18, 2021

@smcalilly, i think the tags are already set up. The are in the top post: GTM-KDVKMFP

Does that work? Or are you talking about something else?

@smcalilly
Copy link
Contributor

@fgregg yes, that works. I was looking at the wrong property in Google Analytics... I can see my traffic when I look at the "Salary" property. Should I finish the download tracking task (#551) before making a PR? That way we can test all the google analytics together and deploy it at once.

@fgregg
Copy link
Member Author

fgregg commented Nov 22, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants