• Skip to main navigation
  • Skip to main content
  • Jump to the main sidebar

Carlosmdh

  • Migra ahora a Google Analytics 4
  • Blog
  • Snippets
  • Tutorials
  • Q&A GA4
  • About Me
  • Contact Me

How to connect GA4 to Universal Analytics

15 abril, 2021

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?
  • How do I do it?
    • If you're creating a new Google Analytics 4 property
    • You have already created a Google Analytics 4 property

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:

  1. You are creating a new Google Analytics 4 property.
  2. 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.

connect a GA4 property to gtag-js
property d

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.

Data Flows in Google Analytics 4
jos

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.

Ga4 Webflow Details

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.

Labels connected in ;GA4

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.

GA4

Sidebar

Sidebar-Alt

Blog - Snippets - Tutorials

Privacy Policy - Cookie Policy - Change your Consent


carlosmdh © 2023 · Made with by carlosmdh

We use cookies to give you the best experience on our website.

You can learn more about which cookies we use or disable them in the .

Carlosmdh
Powered by  GDPR Cookie Compliance
Privacy summary

This website uses cookies so that we can provide you with the best possible user experience. Cookie information is stored in your browser and performs functions such as recognising you when you return to our site or helping our team understand which parts of the site you find most interesting and useful.

Strictly necessary cookies

Strictly necessary cookies must always be enabled so that we can save your cookie settings preferences.

If you disable this cookie we will not be able to save your preferences. This means that each time you visit this website you will have to enable or disable cookies again.

Cookies de terceros

Esta web utiliza Google Analytics para recopilar información anónima tal como el número de visitantes del sitio, o las páginas más populares.

Dejar esta cookie activa nos permite mejorar nuestra web.

¡Por favor, activa primero las cookies estrictamente necesarias para que podamos guardar tus preferencias!

Cookies adicionales

Esta web utiliza las siguientes cookies adicionales:

(Lista aquí las cookies que estás utilizando en la web.)

¡Por favor, activa primero las cookies estrictamente necesarias para que podamos guardar tus preferencias!

  • Español
  • Français