Project

General

Profile

Actions

Support #13511

closed

Google Analytics 4 tagging

Added by scott voth over 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Analytics
Target version:
Start date:
2020-10-28
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

I have been trying to figure out why a social media fellow's Google Analytics aren't working.

It seems that Universal Analytics has been replaced by Google Analytics 4. It is quite different. The Tracking ID (eg. UA-8990737-1) has been replaced by a Measurement ID (eg. G-34SMEHSLW4). I tried plugging the Measurement ID into Settings>>General and it took it, but it doesn't seem to work:

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-8990737-1', 'auto');
ga('set', 'dimension1', 1);
ga('send', 'pageview');
ga('create', 'G-34SMEHSLW4', 'auto', {'name': 'customGA'});
ga('customGA.send', 'pageview');

</script>

GA suggests a global tag like this:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-34SMEHSLW4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-34SMEHSLW4');
&lt;/script&gt;

GA's Universal Analytics still works for old users, but it seems like a new user has to use the new Google Analytics 4. I found this out by creating a new Google Account and setting up GA. I didn't see a way to go back to the old version

Do you think we need to add a new script for the new version?

Actions

Also available in: Atom PDF