-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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 4 #7221
Comments
I've been constantly confused by the Google Analytics system. I think I've asked in multiple places what it takes to support GA4, but to this day I don't know what it would be like 😅 |
I'm already using GA 4 with Docusaurus.... (Alongside old GA) Does anything actually need to be done here? |
@johnnyreilly you probably know better than us 😅 I didn't read the GA4 doc much. We should probably document that anyway so that users can migrate incrementally and know what to do |
Ah yes, last time John sent a PR to update our docs to not use the legacy GA tracking ID format. I still have little idea what's going on though... |
Yeah in fact that PR could use a tweak - I provided the wrong format I think. Will check |
Yeah - this one: https://github.com/facebook/docusaurus/pull/6184/files It's slightly misleading - will correct |
Follow up PR to correct: #7252 |
So what I understand is that for GA4, we should simply keep using the gtag plugin but only update the trackingId to use a new one? Will the Docusaurus google-analytics plugin remain useful in 1 year? What happens if a Docusaurus user was already using gtag plugin with another tracking id (unlike you @johnnyreilly?), and wants a seamless transition IE how will those sites be able to upgrade incrementally without losing the ability to check analytics this year? https://github.com/facebook/jest/blob/main/website/docusaurus.config.js#L77 (using gtag) Atm I'm not sure it's possible to run 2 instances of the gtag plugin for example IMHO we should write doc to help users do this transition:
|
So I'm no expert but I'll share my experience. Consider my config: {
googleAnalytics: {
trackingID: 'UA-51754530-2',
anonymizeIP: true,
},
gtag: {
trackingID: 'G-226F0LR9KE',
anonymizeIP: true,
}
} I have My expectation would be that people do what I've done, which is:
I would think no
Is this a real scenario? Also, from Google's language, I'm not sure they're aiming to support seemless transitions |
Jest: gtag: {
trackingID: 'UA-44373548-17',
}, How does it start sending data to GA4 asap, but also keep sending data to the current instance so that it remains possible to use analytics in the year to come? |
So my own scenario was that I thought I was sending data to GA4 for ages. I just thought it hadn't started showing up yet (they advise the first can take a couple of days to show) Only later I discovered my config was wrong and it didn't work. But that's my own story - could be worth asking the Jest team if they're getting GA4 data using this approach - they may have more information to share! |
I will have to check with @SimenB or Meta, not sure who manage Google Analytics access for Jest 🤪 |
No clue. @rickhanlonii maybe knows? |
I can confirm that using plugin-google-gtag plugin (following instructions there) and putting this web stream starting from G-.. as id works well. |
In #8470 I'm deprecating the google-analytics plugin. Migration instructions from Google: https://developers.google.com/analytics/devguides/migration/ua/analyticsjs-to-gtagjs Note we are also adding a google-tag-manager plugin. Both gtag and google-tag-manager have their specific use-cases. It would be hard to document this in-depth and I'm not an expert but:
Refer to Google documentation to understand which tag system is for you: |
…deprecate google-analytics plugin (#8470) Co-authored-by: Goolsby, Lane <[email protected]> Co-authored-by: sebastienlorber <[email protected]> fix #7221
We deprecated our google-analytics plugin in Docusaurus v2.3: https://docusaurus.io/blog/releases/2.3 The most straightforward replacement is the gtag plugin. Google says here that the "analytics" (used by our deprecated plugin) is a deprecated library: By default the Docusaurus plugins only record page view events. We did the analytics => gtag code conversion a long time ago already and provide the gtag plugin. // old analytics.js code
window.ga('set', 'page',location.pathname + location.search + location.hash);
window.ga('send', 'pageview');
// new gtag.js code
window.gtag('set', 'page_path', location.pathname + location.search + location.hash);
window.gtag('event', 'page_view'); Unless you are If you use custom |
As part of the UA => GA4 transitions, our gtag plugin will now support multiple tracking ids. This permits you to add your new GA4 property without stopping collecting analytics to your old UA property. {
trackingID: ['G-E5CR2Q1XYZ', 'UA-141789XYZ-1'],
} (the order of ids shouldn't matter) This should be released in Docusaurus v2.4 a bit later PR: #8620 |
This comment was marked as outdated.
This comment was marked as outdated.
- Both IDs (GA3 & GA4) should be taken into consideration to permanently track the traffic while migrating. Useful links : - facebook/docusaurus#7221 - https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-google-gtag
Just a reminder that you can now remove your Universal Analytics tracking id, as it's now useless. We removed it from the Docusaurus site in #9384, and now we have one less 404 request + console error |
Have you read the Contributing Guidelines on issues?
Motivation
Google introduced Google Analytics 4 and is going to sunset its former analytics system in July 2023
https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/
Analytics data will not be migrated to the new system
For sites that want to migrate to Analytics 4 and keep historical data, they can run both analytics side-by-side so when the former analytics system is shut down, they have enough historical data
For these reasons, we should not wait until the final deadline to support Google Analytics 4 in Docusaurus, and allow sites to seamlessly/incrementally migrate to Analytics 4.
Self-service
The text was updated successfully, but these errors were encountered: