GTAG within GTM – The what, why and how!

Phil Pearce
First published November 17th, 2023
Last updated November 17th, 2023
Understand GTAG within GTM by delving into its evolution, importance, and practical applications for enhancing web analysis and tracking.
GTAG within GTM – The what, why and how!

Recently, there have been a number of changes to the GTAG within GTM. But why have these changes happened? More importantly, what is GTAG and why is it needed? We’ll explore all that and more, in this article!

This is a write-up of Phil Pearce’s talk at our monthly Meetup. Here, you can find his slides. You can watch the webinar here:

 

History: How did we get here?

Once upon a time, there was only Google Ads. A few years later, advertisers wanted to know more – which ads were working? Then came Google Analytics, which gave marketers the insights they needed. But still, Google wasn’t finished.

Next came Google Optimize (RIP), improving conversion rates via A/B testing and thus improving the effectiveness of ads. Soon after, Google also introduced call-tracking to avoid conversion leakage from non-web actions. Lastly, (for now) we had integration with Google Search Console.

 

Logo of google ads, google analytics, optimize, tag assistant

 

A standard advertiser would normally enable all of these features. They’re all free and they support your ability to buy ads and measure success.

All of these tools were different technologies. They needed to be consolidated and controlled, especially in relation to remarketing. This was one of the reasons why Google Tag Manager (GTM) appeared on the scene. GTM made it easier for advertisers to facilitate these different technologies. Most business owners would be running on a Google Stack.

But what about medium-sized and enterprise sites? These sites will have a budget for Search Ads 360 or managing Bing ads. They’re probably using a paid analytics solution like GA4 360 and may have been using Optimize 360. Finally, they’re probably using Display and Video 360 (DV360), as a means of finding which cohorts of users are the best for remarketing (eg. BigQuery).

The majority of these services would run via GTM (or GTM 360).

 

Logos of bigquery, search google ads, google analytics 360, Google optimize 360

 

Why did we get here?

Google is no longer just making money from ads but from selling services. Google Ads marketing couldn’t really expand any further. The next money-making route was via paid tools and services, hence the need for Google to shift from smaller to medium advertisers.

Google wants smaller advertisers to become big players. After all, that’s where it will make its money. At least, that was the premise.

 

Google wants more advertisers

 

The problem with this approach, though, is that setting up analytics and GTM isn’t always simple. This is especially true for smaller advertisers. There’s a need to introduce something basic, easy to enable that provides decent enrichment and data collection.

That’s how GTAG came about. This had a bunch of events that were already turned on. This included click listeners, history change single page applications, YouTube tracking, scrollers, form submissions, etc.

A small advertiser could tick all the options they wanted, and all the features they needed were enabled. Because they then got more information and more data, they could understand what was and what wasn’t working.

 

Other reasons for the change…

But this wasn’t the only reason for the shift across to GTAG within GTM. Google Analytics, GTM, and Google Ads have all been around for about 15 years. Lots of developers were involved in building them.

Unfortunately, not all developers in different units will talk to each other – sometimes the left and right arms are not as connected as they should be! This has meant that when to connect Google tools together, there is no seamless process. Instead, users need to jump between tools.

 

Illustration of how google tag manager manages various tools offered by google

 

This is the problem that Google is trying to solve. They want to allow advertisers to activate GA, or push remarketing tags, from within Google Ads.

Google has begun this process by introducing segments to Google Ads. These pass over into GA4 and provide a more uninterrupted experience. These, however, also require the frontend technology to be able to add different code via front-end changes.

Again, this isn’t as clean and seamless as it should be. Google-2-Google tools don’t talk to each other!

 

Also… Google is changing focus…

Below is Google’s acquisition list. As you can see, in 2005 Google bought urchin, and a year later acquired a map plugin for the tool.

 

Google’s acquisition list

 

But since then, the focus has massively shifted and Google has tried to move towards a more cloud-based revenue model.

 

Illustration to prove the point that Google has tried to move towards a more cloud-based revenue model

 

This focus has aligned with its revenues. For Google Cloud, revenues were $8 billion for the
quarter. This is an increase of 28%. During this period, the platform had an operating income of $395 million.

 

1st Party data…

There’s another big reason for the change, and why Google is trying to consolidate these technologies. In addition to advertisers buying paid solutions, there is additional Google-2-Google data. This includes Merchants Center, Google Ads, and Search Console, and BigQuery.

These all sit separately; the connection between front-end technology (i.e. JavaScript and tools like Google Ads is risky because it’s happening in the browser).

In the server, where you’ve got Merchants Center and Google Ads, Google has added direct integrations with tools like Shopify and Salesforce. This means that valuable first-party data can flow back and forth.

For example, Shopify can tell us about new or existing customers. This is really helpful information for bidding on Google Ads. The same applies to tools like Salesforce where you have the revenue of a closed lead. Again, this is helpful for bidding on qualified leads (rather than web leads).
Other information that can be gleaned from first-party data includes:

  • LTCV
  • New vs Returning
  • COGS & ROI
  • CaC
  • RPL

 

The other advantage of server-to-server is that it is 100% accurate. In clientside you could be dealing with an adblocker that prevents 10-15% of traffic or conversions being sent in.

But to move towards this juicy first-party data, Google needs to make sure that the clientside tracking is robust before it can shift to server to server.

 

Google’s challenge

But there is yet another reason why Google is trying to shift to GTAG. Something is taking a big bite out of Google’s lunch.

 

Google’s challenge

 

Apple is either shortening cookies from a year and a half to seven days or stripping off GCLID IDs in private mode. This is a big problem for tracking, and why Google wants to enable enhanced conversions or email hashes rather than cookies. It’s introducing different countermeasures to mitigate the direction that Apple is heading.

Below is an example from the New York Times. If you’re on an iPhone, you can click the ‘A’ in the bottom or top corner and view a privacy report.

As you can see in the image below, five trackers have been prevented from the article. You can probably guess which five were at the top of the list.

 

5 trackers have been prevented in an Apple's iphone

 

Unsurprisingly, we have Google Tag Manager, Doubleclick, and Google Analytics. Apple pretty much has a target on Google’s head. By relying on clientside technology, there’s not much Google can do.

 

Countermeasures

The only solution is server-to-server, which Apple can’t block, or enhanced conversions and email hashes.

Google wants to build a big wall around this conversion data and prevent Apple from blocking data. On that note, Google has recently announced Google Data Manager. This connects directly to third-party tools like Zapier and ActiveCampaign.

The tool is likely to become increasingly more and more essential. It’s now more important than ever to ensure you’ve got good first-party data flowing into Google Tools to enable good ad decision-making.

Another countermeasure is as part of GTAG, GA4 now automatically tries to collect email addresses spotted on the page. This is then sent as a hashed value, getting you around the issue of blocked cookies.

Finally, we have GTM Serverside, which is less likely to be blocked by Apple. GTAG is a means to facilitate the consolidation of the majority of smaller advertisers. This is because it allows them to shift to more advanced bidding (if you’re new to GTAG, why not check out our GTAG cheatsheet?)

This is how it looks in the interface (seen below). The GA3 variable tag has now changed to a config tag and an event tag.

 

GA3 variable tag has now changed to a config tag and an event tag

 

The image below shows a GA4 config tag. This is sending a page view at the same time. The variables are split between either a configuration variable or an event-based value.

 

A screenshot that shows a GA4 config tag

 

A quick note about this setup. We now set the declarations first and the page_view to ‘false’. This fires after the config tag has finished declaring. We wouldn’t normally set this to ‘true’ – this is what happens when Google has auto-migrated from GA3 to GA4.

You’ll notice that some of the variables have tick boxes next to them. These are whitelisted values and you’ve generally put them in the right place.

The variables ‘content_id’, ‘content_group’, and ‘content_type’ have been marked as event variables, as they are an attribute of a page. This is why there is no tick alongside them in the list.

There is no tick next to the User ID as a default variable within the config tag. There is, however, a tick within the event tag. It’s worth setting the user ID in both places because the event tag takes precedence over the config tag. Additionally, it’s worth setting currency as an event tag as it’s normally set at the event level.

Google doesn’t automatically move these fields into a configuration tag or an event tag. This is a job left up to you, unfortunately.

 

Event variables

The image below shows event ‘category’, ‘action’, and ‘label’. You can see that each option has a tick next to it, as they are set in the right place.

 

A screenshot that shows a GA4 evebt tag

 

You also have the option of setting a Google event settings variable. For some bizarre reason, Google has set a lowercase ‘t’ in the name. Although strange, it’s best to keep this to lower-case. Always try to stick to the default names given by Google to avoid later issues.

Apply areas such as content groups to global event settings so that they are updated on page transitions.

 

GA4 event download

 

Why update tags to Centralised variables or change G-xxxxx to GT-xxxxx

The Google tag now allows you to load either a Google Analytics tag or a GTAG. In order to see the GT tag you must load it into the Google tags within GTM. You’ll see your Google Analytics tag and your GT tag.

 

changeing G to GT for Tag ID in GA event config tag

 

The two in this case are connected together. If you change G to GT, this would then load GTM which in turn, would load GTAG which would load GA4. There is no speed benefit to doing this, it’s actually the inverse. By loading a wrapper within a wrapper, the GTAG is actually slightly slower.

The benefit is more of a consolidation of your remarketing tags, as well as your cookie settings. For example, If you wanted to globally set Google Ads remarketing and DoubleClick, the GTAG would allow you to consolidate these into one group.

 

Issue1: JS library injection bloat & tag dependency bugs

Sometimes you can have multiple libraries declared. This is demonstrated in the image below. A single-page application has loaded GTM four times. Potentially, if you’re using a GTAG library declaration, could set this to once per page. This helps with consolidating a load event.

 

JS library injection bloat & tag dependency bugs

 

Issue2: Page (not set) due to event triggering before page_view

When you load your GA4 or GTAG library, ensure that it is loaded first, then fire the page views second. This helps to avoid any ‘page not set’ issues. You might have noticed the same problem on GA3 if you have an event fire before a page view.

Google has deployed an update with the first interaction and first session, where it now sends the page location. This slightly reduces the number of ‘page not set’ issues.

We have split out the event tag in the image below. You can see the configuration which is set to ‘once per page’. This has been intentionally switched from ‘page loaded’ to ‘consent initialization’, this ensures the trigger runs before everything else.

Once this has been run we have the page_view tag. This is fired as a tag sequence after the GA4 event has been fired. If you’ve got a hash change event, this could be added as an interaction for the page_

 

 interaction

 

Issue3: CD & ContentGroups not updating on SPA due to persistent settings

The third reason for the GTAG consolidation is that custom dimensions were not updated properly. This is because the set commands are a bit like constants. They’re not designed to be updated, whereas events potentially do update and take precedence.

In other words, the GTAG is potentially more robust on single-page applications (with a couple of notes or exceptions).

Previously, when you were sending a page view with a content group of home, there may have been an issue when you traversed to a product page. GA still thinks you’re on the home page and provides inaccurate reports.

GTAG has some mitigating steps with event updates to make this more accurate. Unfortunately, they introduced some further issues in the process.

 

CD & ContentGroups not updating on SPA due to persistent settings

One of these new issues is that page location still persists on outbound clicks and enhanced events. This is a known issue and hopefully, will be fixed soon.

 

SPA

 

For this issue, it is best not to use GA4’s native history change events. There are two reasons for this.

Firstly, you can’t control content_id/content_group/content_type. Secondly, due to the page_location persistence on enhanced events on the second page (aka route change).

If you are overwriting the page_location on a single-page application site, you potentially need to invoke the config tag on each route change. Additionally, make sure you don’t use once per page on the config tag.

To keep things simple, stick with GTM for history changes and pop-state events. If you do use GTM, be careful not to fire the page_view twice on load, especially if there is a push state change or replace state. Check to see that page_location is not the same, you can use a blocking rule to do this.

 

JS

 

GA3 set-up Settings Variables mode

Ecommerce Event Variables

When setting up events in GTM, you’ll tick boxes to give you a guide to ensure variables are in the right place. But sometimes, these tick boxes don’t appear. That’s where our GA4 cheat sheet comes in handy.

 

GA4 event and dimensions cheatsheet.

 

We’ve included notes to let you know when a tick box is missing. For example, the screen_resolution event doesn’t include a tickbox, even though it should always be set as a screen resolution tag.

Similarly, there’s only a tickbox when user_ID is sent as an event. Potentially, you’ll need to send this as an event and an ordinary configuration.

In terms of user properties, Google has consolidated the on-load configuration event on a configuration variable. User properties, however, are still separated. This is something that is unique to GA and doesn’t apply to Google Ads or DoubleClick and has been bolted on to GTAG.

The below image shows a purchase event. Both the ‘user_is_new_customer_type’ and the ‘user_life_time_value’ are helpful fields to push into GA4 for analysis.

 

Screenshot of a purchase event

 

They do, however, also exist as event-based variables. These are ‘new_customer’ and ‘customer_lifetime_value’. Both events are a little unusual in the sense that they potentially need to be sent in two places. This includes GA4 as a user property and GTAG if you’re using a Google Ads variable.

 

Google Ads variable

 

Additionally, although you can set the item field as a global event, you’ll notice that there is no tickbox for event variables if you’re using eCommerce.

 

Google tag event setting

 

Client-side roll-up trackers

If you’re doing any client-side roll-ups, and not on a GA360 account or using GTM serverside, you can create a filtered profile through GTAG. You can do this by using a comma followed by a space. You can see an example of this in the image below:

 

Client-side roll-up trackers

 

This is set within the configuration of the on-load tag. As part of the auto migration to GA4, Google has followed this format, but in doing so, broken client-side roll-ups for everything apart from the first configuration.

In other words, the ‘G- 1’ would be sent, but the other variables would be ignored or dropped. To fix this issue, split out your on-load configuration from your event configurations. The above method still works for event variables, but not for an on-load GTAG declaration.

If you’re doing a client-side roll-up, you should do the configuration separately. Wait for the on-load GTAG configuration to fire, and create a trigger group to verify that this has been executed. Finally, you can trigger your page_view.

 

 trigger group

 

The image below is how the three configuration tags look in rollup form.

 

configuration tags look in rollup form.

 

This is the route you’ll need to take if you’re doing client-side rollups and want to work with multiple GA4 profiles, as you can’t filter profiles in GA4.

In Summary

There’s no particular benefit of switching from GTAG to GTM yet. However, in terms of consolidating your code base, there is some usefulness. If you’re a basic advertiser, make sure to turn on all the tickboxes for GTAG (apart from form tracking, which generates false positives).

Generally, Google is moving towards first-party solutions for first-party data. This will be increasingly key, and the ability to connect these sources will continue to become easier. Remember, Google does not easily connect its own tools, but is moving in that direction (Google Ads data manager is a prime example).

Finally, one important note, about GTM serverside. Taking the example of Facebook, always try to run the website in hybrid mode, send a clientside pageview or transaction, and also send a serverside transaction.

Then, dedupe based on a timestamp. By doing so, you’ll then get a maximum count of transactions. Sometimes an adblocker could stop a clientside transaction from being sent, but the serverside option still gets through.

Phil Pearce
Follow me
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Articles from our Blog
0
Would love your thoughts, please comment.x
()
x