4 minutes reading time (788 words)

But I really do need Google Analytics 4, show me how to add it.

October-G4

In my previous article: “As Googles Universal Analytics comes to a close, what alternatives if any do you need?” we explored Google Analytics' origin story. Took a look at whether Analytics is even right for all sites, and the impact just adding Analytics defacto can have.

And we touched on one of the alternatives out there.

Join me now in a deep dive into the setup of GA4

So reading the last article didn't persuade you otherwise? Then https://marketingplatform.google.com/about/ is the place for you to start the dive into GA4.

image10

Google is unifying some of its key tools into experiences that fit different sectors. The approach seems to be that, as a company, you “need” all of these tools to work properly.

Each tool is an aid to getting the most out of the others and together you can do it all faster and smarter.

I'm not very smart as I only have two of their tools in my marketing platform dashboard.

image6

If you want to go straight to Analytics then the last curated image and google advert is 

https://marketingplatform.google.com/about/analytics/

image5

Then we get to the heart of the signup process

https://analytics.google.com/analytics/web/?authuser=0#/provision/SignUp

This will take you to either a sign-up if you are not already logged into your Google account or the page to start a new Analytics account.

image3

Here you can add an account name. I usually have one account per website and so would change “My Account Name” to something more recognisable.

You do not need to tick any of the boxes on this page if you do not want to agree to the use of your data by others.

Press next and you will see this page

image8

Property Setup

You can set up multiple properties in one account. I keep the app and website properties separate and so would label the property accordingly

image4

Next a whole lot more questions about your business size, and industry sector, again none of these do you need to select, you can keep your information private. On hitting next you will be asked to accept the terms and conditions which you must accept if you want to move forward.

image2

Next, we are presented with a platform, where we would choose the Web option.

image1

Data Stream

Once selected you are asked to configure the data stream. Here the “enhanced measurements” is selected by default and you can go into the enhanced measurements setup to further configure it.

Once through with choosing the configuration setup and on saving and moving on we come to the web stream details.

At last our journey to get that elusive and highly questioned piece of code is almost at hand, you are in the foothills of Mordor and dear hobbit, our quest is nearly at an end… or is it?

image7

We have the Measurement ID. You thought it was a tag or tracking code, but it appears we have been wrong. It is a Measurement ID, it has always been a Measurement ID.
The structure is different to the old, whereas we had codes such as
UA-XXXXXXXX-X (8-1x’s)
Now it's
G-XXXXXXXXXX (10x’s)

Clearly, fidelity has slipped and we have more X’s in these modern times!

Add the Tag

All the information is here to add your tag to your site.
Many templates provide a simple drop in section for the GA4 Measurement ID but on this page you can also check the Google Tag section where you can find other ways to add the tag including Google Tag Manager.

And that's it, you have your shiny new GA4 tag. Now you can add the code needed directly to your template or via some other means, Regular Labs Re-Replacer or perhaps something like a custom module or a plugin. You can find your code by clicking on View Tag instructions which are located in the Google tag panel.
Once clicked it opens a panel that has several website builders listed. Joomla is not one of those. Luckily there is a tab saying “Install manually”

There we find the familiar code which looks something like this:

<!-- Google tag (gtag.js) -->

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

 

  gtag('config', 'G-XXXXXXXXXX);

</script>

And there you have it. Once installed and data is collected the previous page will get a green data flowing indicator.

image9

And you will know all is working. If it's not showing this within 48 hours of setup then you will need to do some debugging.

So we have decided to install some Analytics, we have picked GA4 and we have set it all up.

Next time we will look at what we can actually see from this data collection and what use we can put it to.

0
The Joomla Force is strong in Central Europe
Off to Cyprus, ehm, Cypress - How Joomla does its ...
 

Comments 2

Already Registered? Login Here
Julian White on Friday, 21 October 2022 15:53
Useful information.

Great information about this subject especially as I'm currently adding Google Analytics to my sites. You have explained the process far more clearly than the Google help documents ever could.
However, it appears that Joomla 4's default template Cassiopeia does not have the facility to enter any analytics data as standard so this leaves entering the code in the index.php file instead.
Could this be a feature request perhaps?

0
Great information about this subject especially as I'm currently adding Google Analytics to my sites. You have explained the process far more clearly than the Google help documents ever could. However, it appears that Joomla 4's default template Cassiopeia does not have the facility to enter any analytics data as standard so this leaves entering the code in the index.php file instead. Could this be a feature request perhaps?
Eoin on Wednesday, 02 November 2022 15:01
Great article - well needed!

Great article Phil thanks so much for spending the time writing it.

0
Great article Phil thanks so much for spending the time writing it.

By accepting you will be accessing a service provided by a third-party external to https://magazine.joomla.org/