-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add google analytics 4 support #74
Conversation
|
||
w.loadJSDeferred('https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}'); | ||
}(window, document);</script> | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -60,3 +60,6 @@ titles_from_headings: | |||
# - languages/index.md | |||
# - process/speclet_playbook.md | |||
# - process/testing_strategy.md | |||
|
|||
|
|||
google_analytics: G-2NX5YFW46E |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assume this is ok to be in the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I see what's going on below. so do we want the value in the repo or 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed BY_DESIGN approved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, for future reference this is not a secret. It'll show up many times in the network tab as part of URLs. It's just the way GA works. If someone else wants to steal it, they're welcome to enjoy their console.log'd wrong domain messages courtesy of GA.
The GA built into this theme is the old UA version which ceased processing data in July. This sets up GA4 instead.
I've submitted similar code to hydejack in PR330. Based on other issues/PRs on that repo its not likely to be merged soon. In this PR I've torn out most of the complexity that I'm unable to test (not having a pro license) and we don't use anyway.
A variation of this was tested on my fork.
Edit: GA indicates its received some pings in the last 24 hours so I think this is working.