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

[docs] Support Google Analytics 4 #36123

Merged
merged 19 commits into from
Mar 29, 2023
Merged

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Feb 9, 2023

Seems to be working. Maybe it can be merged, to get time to check all the metrics are the same between UA token and GA4 token

If I'm correct, the behavior is to push events in window.dataLayer which will be used by the script from https://www.googletagmanager.com/gtag/js to send data to Google Analytics

The few visitors in prod before merging, it's me doing tests :)

@mui-bot
Copy link

mui-bot commented Feb 9, 2023

Netlify deploy preview

https://deploy-preview-36123--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against 1a22c61

@alexfauquette alexfauquette marked this pull request as ready for review February 17, 2023 10:00
@zannager zannager added the docs Improvements or additions to the documentation label Feb 22, 2023
@alexfauquette alexfauquette changed the title [WIP] Support Google Analytics 4 [docs] Support Google Analytics 4 Feb 26, 2023
docs/pages/_document.js Outdated Show resolved Hide resolved
@siriwatknp
Copy link
Member

@alexfauquette I don't have other comments. May be best to let @oliviertassinari do the final review (I don't have full context related to GA).

@oliviertassinari
Copy link
Member

@alexfauquette Thanks for working on this! The most complex GA integration we have is with the store, where I integrated the e-commerce features: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce. To be fair, I had little use for these e-commerce analytics in the past. But in any case, GA on the docs should be much simpler. I hope I can find time to review it.

@alexfauquette
Copy link
Member Author

@oliviertassinari I don't get your point, about GA integration with the store. The store is in a distinct repo, so it will be a distinct PR. Especially it's more about checking the event sent are still in the correct format for GA4.

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get your point, about GA integration with the store. The store is in a distinct repo, so it will be a distinct PR. Especially it's more about checking the event sent are still in the correct format for GA4.

Right, sorry, I mean that the website/docs is a simpler case.


I have spent about 2 more hours on this. I initially had no data at all on https://analytics.google.com/analytics/web/?authuser=1#/p354125369/realtime/overview?params=_u..nav%3Dmaui&collectionId=life-cycle. I have made the changes up to the point where I would get coherent data in this dev environment. "Coherent" in the sense of matching how I navigate the docs. I don't see any issues anymore but who knows 🤷‍♂️.


From what I understand, we can't migrate the data from UA to GA4. I guess we can dual tag for 1 year until we have enough historical data to compare YoY https://webmasters.stackexchange.com/questions/135970/google-analytics-is-there-a-way-to-import-universal-analytics-property-data-in.

@alexfauquette
Copy link
Member Author

They promise to keep UA data for 6 months: https://support.google.com/analytics/answer/11583528?hl=en

So to analyze data from one year to another it might be interesting to export them

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the sooner we dual collect the better. I have rebased the PR and did another small clean-up. From the quick test I did locally, navigating 3 pages:

Screenshot 2023-03-27 at 01 48 47

the dashboard seems to update correctly, https://analytics.google.com/analytics/web/#/p354125369/realtime/overview

Screenshot 2023-03-27 at 01 47 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants