I have tried to update my Blogger blog to the new Google Analytics tracking (GA4). But I have noticed that my old tracking with Universal Analytics was discontinued (data won't be fed).
Here is the solution I have come to fix it and keeping using UA and GA4 tracking in parallel.
I've found this blog post helpful: https://www.analyticsmania.com/post/upgrade-to-google-analytics-4/
Tried configuration
UA connected to new GA4
In blogger edit HTML theme and add the tracking code snippet:
<!-- Global site tag (gtag.js) - Google Analytics --> <script async='async' src='https://www.googletagmanager.com/gtag/js?id=UA-84853115-1'/> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js';, new Date()); gtag('config', 'UA-84853115-1'); gtag('config', 'G-FJS6JR3WS0'); </script>
Unfortunately with this approach, the data for the UA tag stopped to be fed. (but the GA4 data is properly fed.)
Fix using Google Tag Manager
I have replaced the normal tracking by the usage of the Google Tag Manager (GTM)
GTM in Blogger Theme
You need to add the GTM Tracking code snippet in the theme HTML under the <head>
Note that you need to replace the red & by & as explained here.
Test/ Connect
Troubles I got:
To test debug preview I had to do this in incognito mode (It seems some extensions were blocking the test.) Else I got a could not connect to a tag / time-out error.
Now after the test I see again a view in my GA Report for the UA tracking :-)
Strangely for my GitHub.io Homepage the connection/ upgrade from UA to GA4 was seamless and both data are tracked/ fed.
When updating my blogger GA I could not check this checkbox: Enable data collection using existing tags. etc
I've found this blog post helpful: https://www.analyticsmania.com/post/upgrade-to-google-analytics-4/
No comments:
Post a Comment