I was hoping to better understand how the new Google Analytics 4 works with React.
I thought that it'd require wrapping around a Route component but it seems as though pasting the script tag generated by Google into the index.html is enough to get it to send events which includes showing all the page views, etc. on the GA site.
If anyone could explain why that works or how it could break, that would be greatly appreciated. From everything I've seen and limited experience with the old UA system it appears that it shouldn't.
It feels like there isn't a lot of information out there due to how new the system is and Google's docs on it aren't great.
Thanks!
question from:
https://stackoverflow.com/questions/66056206/why-does-putting-a-ga4-script-in-the-index-html-give-correct-page-events 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…