-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Google analytics now has two different styles of tracking codes that require different javascript. #423
Comments
This issue has been automatically marked as stale because it has not had recent activity. If this is a bug and you can still reproduce this error on the If this is a feature request, please add as an Idea under discussions and elaborate on why it is core to this project and why you feel more than 80% of users would find it beneficial. This issue will automatically be closed in 7 days if no further activity occurs. Thank you for all your contributions. |
From reading the code, I believe the |
I've submitted a PR to address this one. |
Hi, any chance @mikebowler's PR could be merged? Is there any other workaround? |
I'm also interested in seeing this get merged. |
based on this: mmistakes/so-simple-theme#423
Thank you so much @mikebowler, I've applied this manually to my site, I couldn't figure out why my update in google-analytics.html wasn't working. |
Google analytics now has two different kinds of tracking ids. The old Universal Analytics style starts with "UA-" and works properly with what's already checked in. The new Google Analytics 4 style starts with "G-" and requires the new Javascript below.
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{{ site.google_analytics }}'); </script>Note that I was going to submit a pull request but couldn't figure out why the analytics code was in two different places and what the interactions were. It's in both scripts.html and google-analytics.html
The text was updated successfully, but these errors were encountered: