I recently worked on a Google Tag Manager (GTM) and Google Analytics 4 (GA4) configuration project for a new website product launch. This was across two subdomains on the same top level domain, both of which already had GTM tags with a GA4 basic page view tag set up, along with a number of Universal Analytics events.
Everything was working fine and had been since they were initially set up.
The aim of the project was to set up custom events and conversions that would demonstrate a user landing on the main site, then clicking through to the subdomain to follow a sign up process through to completion.
The main site is WordPress, and the subdomain is a bespoke custom site built using React so was essentially an SPA architecture, where all content is loaded on a single page and dynamically updated as needed.
This shouldn’t be an issue though for GTM, you can use History change based triggers to detect when a user moves from URL to URL.
Initially I was working on a test environment before the new content and functions were rolled out to the live site ahead of the product launch.
In both cases, the events were set up, and all was working as I tested the events through to conversion I could see them firing correctly and being tracked as events in GA4.
However, when the pages went live and users were accessing the pages, nothing was being tracked.
I initially thought it might be a JS or SPA related issue, but no matter how many times I tried and tested different ways of tracking a user, whilst everything worked ok for me, nothing was tracking for any other user.
Ultimately, I had to ask myself some basic questions to try and get to the bottom of it, which I eventually did.
TLDR
If you can’t see events you’ve created in GTM appearing in GA4 you more than likely to find that your account does not have publish permissions
How do I make sure my tags and triggers are set up correctly in Tag Manager?
When you have created you’re tags and triggers, use the preview and debug mode to test your tag and trigger setup. This feature allows you to test your setup in a staging environment before pushing it live. It will also provide you with information on what tags are firing and not firing, and what errors might be occurring.
Once you’ve set up the tags and triggers such as:
You then launch preview mode:
From here, after you have launched you’re site, you can see a tab for the tag assistant.
What is Tag Assistant?
Tag Assistant is a browser extension for Google Chrome that helps you troubleshoot issues with your Google Tag Manager implementation. It works by analyzing the tags and data sent to Google Analytics, and providing you with real-time feedback on whether your tags are working correctly:
You can see a summary of all the tags that have fired on a page as well as clicking default and custom events to see what fires when:
The state of any default and custom variables after any default of custom events have fired:
And the current state of the data layer:
From the above on my home page, I can see that a page view has fired, a linkedin pixel and some custom scripts I use.
One GA4 event I have set up is to detect when a user has clicked on a specific section of links on my home page.
So, when I click on such a link, I see the following in tag manager to show as and when it fired:
You can then also click on the tag to see how/why it fired and what variables were passed:
This is all firing as expected, so now to check it’s tracking into GA4
How do I view Google Tag Manager events in Google Analytics?
There are two ways to do this, real time tracking and debug view
What is real time tracking in GA4?
Real-time tracking in Google Analytics 4 (GA4) is a feature that allows you to see the data from your website or app as it happens, in real-time. This means that you can view user behaviour and interactions on your site or app as they occur, without having to wait for the data to be processed and analysed.
To access real time reports, click “Realtime” in the reports menu:
Here you can see the events that are occurring on your site, such as my home page link click event:
So far, so good.
What is debug view in GA4?
Debug View is a feature that allows you to see the data that is being sent to Google Analytics in real-time. GA4 provides a powerful set of debugging tools that can help you troubleshoot issues with your tracking implementation, test and verify new configurations.
To access this, go to “Debug View” in your GA4 property menu:
Where like real time tracking, you can see events that are firing, but the difference is that you only see data sent from users visiting the site in debug mode only. So basically you, when you’ve access the site via GTM and is why this URL parameter is appended when you launch the site in preview mode:
https://organicdigital.co/?gtm_debug=1679854325388
you will then see what fires when in debug view:
Again, everything is working fine, and this was the case on the recent project.
Which led me to ask myself the next question:
What could be the reasons for my events not showing in Google Analytics?
After much googling (and a spot of binging), I found myself with two possible answers.
The first is quite technical:
The ga() Method Has Been Hijacked
This refers to a situation where the ga() method, which is the JavaScript function used to send data to Google Analytics, has been modified or replaced by another script or piece of code.
When the ga() method is hijacked, it means that the data sent to Google Analytics is being intercepted and possibly manipulated before it is sent to Google Analytics servers. This can result in inaccurate or incomplete data being collected, which can affect the accuracy of your Google Analytics reports.
There are several ways in which the ga() method can be hijacked. For example, a third-party script or browser extension may be modifying the ga() method, or a malicious attacker may have injected malicious code into your website that modifies the ga() method.
To find out more about how to diagnose this issue, these were the articles I found, here:
https://www.analyticsmania.com/post/event-tracking-in-google-tag-manager-is-not-working/#hijacked-ga
and here:
whilst the site config on the JS generated site did demonstrate similar behaviour to what is described in those articles, I noticed some other things going on that suggested going down the technical JS issue route was a case of not seeing the woods for the trees. It felt like a school boy error.
You Have Not Been Assigned Publish Permissions
When I was added to the GTM account, I had been added with approval permissions, and not full admin able to publish.
FFS
In my defence, to date, I’ve always been added as an admin user with full permissions it’s really not obvious when using GTM if you have been assigned Publish or Approval permissions, but, this will make all the difference as to whether changes go live when you click the publish button.
To explain further:
What are the user roles in GTM?
There are 2 roles as follows:
User: A user in GTM has read-only access to the containers in the account. They can view all tags, triggers, and variables, as well as see the current state of the container version. However, they cannot make any changes or modifications to the container or its contents.
Administrator: An administrator in GTM has full access to all containers within an account. They can add, edit, and remove users, as well as grant or revoke access to containers. Administrators can also create and publish container versions, manage tags, triggers, and variables, and modify container settings.
What are the user permission levels in Google Tag Manager?
Further to the above, aside from full administrator access, there are 5 permission levels as follows:
No Access: Users with No Access cannot access the account or any containers within the account.
View: Users with View access can view container contents and tracking information, but cannot make any changes or modifications to the container or its contents.
Edit: Users with Edit access can make changes and modifications to containers, as well as create, modify, and publish container versions. They cannot manage users or change user access to the account or containers.
Approve: Users with Approve access can review and approve container versions, as well as publish them to the live environment. They cannot create or modify container versions, manage users, or change user access to the account or containers.
Manage: Users with Manage access have full access to all containers within an account. They can add, edit, and remove users, as well as grant or revoke access to containers. They can also create and publish container versions, manage tags, triggers, and variables, and modify container settings.
The confusion came when I was adding tags and triggers and click “publish”, because that makes me think the changes will be published. In full admin mode, when you commit changes the UI is as follows:
In approval mode, it looks like this:
You’d think they’d amend to button to read “submit for approval” or similar.
The other give away was when looking at version history, you can see every time I clicked submit the version was updated, however, the live version was still the same one that was in place when I started working on the project:
Fair to say, even after several years of working with GTM, every day is a school day.
I hope this helps you with an similar issues you are facing, but if not or you are having trouble with any of the aspects of GTM mentioned in this post, please feel free to get in touch using the contact form below.