In a previous article I talked about the possibility of connecting a Google Analytics 4 property with an existing Universal Analytics property.
Then, a few days ago, reading another article by Pablo Moratinos in which he talked about how to update to Google Analytics 4 I came across the following comment:
Jordi
Hi! Thank you very much for this video. I'm using Shopify and I can't edit the global tag as the tracking is entered natively by setting the UA.
How should I do it?
Thank you!
https://pablomoratinos.es/como-actualizar-a-google-analytics-4/#comment-644
This has encouraged me to write this short article where I describe a possible solution to a scenario like the one described by Jordi in his comment. This solution would involve connecting an existing Universal Analytics property to a GA4 Property.
One detail before we start, to be able to do this Universal Analytics must be implemented on the website using the gtag.js tag, i.e. the one I show you below:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-Y"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXXX-Y');
</script>
This will happen if you have implemented this tag by adding this script to the header template of your website, or if you have used a plugin / module that has programmed the insertion of the tag (for example a tag insertion plugin or certain RGPD plugins) or in the case that you have implemented it with an HTML tag from Google Tag Manager. If you have implemented the ID of your Universal Analytics property from Tag Manager with the predefined tags, this procedure will not work.
Table of contents
What is the idea?
Simple, take advantage of the fact that we already have Universal Analytics installed using gtag.js so that it passes the data to both the UA property and the GA4 property. However, if you have more advanced implementations in this tag, it is more than likely that some data will not be passed to GA4. But less is nothing.
How do I do it?
Let's define two scenarios:
- You are creating a new Google Analytics 4 property.
- You have already created a Google Analytics 4 property, but you don't have it implemented and you want to connect it to Universal Analytics.
If you're creating a new Google Analytics 4 property
When you are creating a new GA4 property from the GA4 configuration wizard found in the administration section, in the first step you will have the possibility to connect the GA4 property with the gtag.js tag if it is the one enabled on your website. If so, you can choose to enable or disable that connection. If you are not using the gtag.js tag, don't worry, the wizard will not allow you to enable it.
If you are in the option on the right, just check the option to enable data collection and follow the process, you will not have to do anything else. Simple right?
You have already created a Google Analytics 4 property
Ok, you didn't know that and you didn't connect your GA4 property to the gtag.js tag. That's ok.
In this case you will have to go to the manage section of your Analytics account and in the properties column, once you have chosen the GA4 property you want to connect from the dropdown above, you will have to click on the Data Flows option.

Once we've done that, we'll have a list of the data streams that we've defined in our property. Normally there will only be one and it will be the one for the website we have, but if not, choose the dataflow you want to connect to gtag.js.

When you choose the data flow, you will see that a page opens with the details of your GA4 property. In the group of more options the first one is connected website tags. Normally this is set to zero, so click on that option.

Once you have done that you will access a new page where you are asked to enter the ID of the tag, in your case the UA-XXXXXXXXXXXXXXX-Y of the Universal Analytics property you want to connect and a Nickname, i.e. a descriptive name so you can identify that tag. click on connect and the list of connected tags will appear at the bottom. The same place from where you can disconnect them later if they are no longer useful.

And with this you would have your gtag.js tag connected and sending data to both Universal Analytics and GA4.
A few details to finish:
Remember that you have to have the gtag.js tag implemented, any other option won't work.
If for some reason you have already implemented the Google Analytics 4 tracking tag with its identifier, the one that starts with G-XXXXXXXXXXXXXXXXXX, remember to remove it, otherwise you will collect everything in duplicate.
I invite you to leave your impressions and/or doubts in the contact form and to suggest new topics that you would like me to cover in these tutorials. I will be happy to answer you by email and write in this blog.