The definitive guide for building a solid GTM architecture that saves you time and money
When Google launched its Tag Manager, marketers were buzzing with excitement. Finally, a tool that could allow them to break that umbilical cord between them and developers. FREEDOOOOOOOOOOOOM!!!
Even though this tool promised to be ‘simple, easy, and reliable,’ without some technical knowledge or training, marketers may soon find themselves knee-deep into some very treacherous quicksands. Since GTM injects new code lines directly into your website, a poorly implemented architecture can negatively impact a website’s performance.
Worry not, though! Growth Savvy is here to the rescue!
Strap in because, in this detailed guide, you’re about to discover:
- The 5 rules for creating a scalable and easy-to-track GTM architecture
- The key for structuring the perfect data measurement plan
- How to create/update your data-tracking setup in minutes instead of hours (this can save you up to 19-hours for every 10 updates you need to deploy in GTM)
- How following a business’ golden data trail can create a cascade of new revenue opportunities & more.
Tags. Triggers. Variables. Explain them like I’m five.
If you’ve already started using Google Tag Manager, you may already know it’s based on tags, triggers, and variables.
Variables – are used to get/collect information.
Triggers – are used to select the moment when you want to send information.
Tags – structure the information that will get sent.
A tag cannot exist without a trigger, and a trigger cannot exist without a variable.
Now, let’s piece it all together.
So, when using Google Tag Manager, you will configure a tag with specific variables (that contain the information you need) and select a trigger (that will send that information at the moment you wish for it to happen).
Confused? Worry not, young padawan. The following example should put things into context and help you get a better understanding.
–> How to use GTM to track a Facebook share button
Let’s assume you want to track a Facebook share button. You want this data sent to Google Analytics so you can see what type of content motivates people to share.
Since we’re talking about data collection, we first need to identify the variable. By pulling the code curtains aside, we can see it’s the a href one – as this is the only aspect that code-wise tells apart the Facebook button from all the other social media buttons.
(We’re looking to track all these website micro behaviours independently.)
<a href="https://facebook.com/example/" class="social_link" target="_blank">...</a> == $0
<a href="https://twitter.com/example/" class="social_link" target="_blank">...</a> == $0
<a href="https://www.linkedin.com/company/example" class="social_link" target="_blank">...</a> == $0
This variable will check the href attribute for every social button type that gets clicked and send the info to Google Analytics.
Now let’s switch our focus on the trigger.
Do you want to track these buttons only on a few specific pages? Or across your entire website?
You can do both.
If you want to activate this tracking activity only on a few specific pages, you’ll need to add a triggering condition.
Below you can see how the trigger configuration would look like if we chose to set up the event site-wide.
And finally, to put everything together this is how you will structure your tag.
Now that you understand Tags, Triggers & Variables, let’s get back to building that scalable, easy-to-track, and time-saving GTM architecture we promised you. Here, at Growth Savvy, we have 5 rules that help guide us through the process.
1. The 5 rules for structuring the perfect GTM architecture
Rule #1: Build a measurement plan you can share with any data stakeholders
How many times have you accessed a Google Analytics account where absolutely nothing made sense? Where all you could see were thousands of chaotically implemented events that made you want to scream at the screen or run and hide under a blanket?
A well-structured measurement plan will ultimately allow anyone who looks at your Analytics to get a clear understanding of how users behave on all levels of your funnel.
The measurement plan will act as the building block towards creating your GTM architecture.
Even though there is no one-size-fits-all measurement plan, having a starting point that you can adjust afterward will always prove a colossal time-saver and act as a motivation booster. If you’d like to, we can send you the Measurement Plan Template we use via email. Just click the button from Sticky Box that follows you as you scroll down this article or simply add your email address in the content upgrade box found at the end of this post.
However, if you’d like to carry out building your own measurement plan from scratch, make sure to take into account the following. First of all, the structure of the measurement plan itself has to take into account the following aspects:
- The business model
- The website/app technical architecture
- The general and custom data accuracy issues we need to solve
The other element you need to consider has to do with structuring Event categories, actions, and labels. And we can’t stress out enough the importance of this.
Going back to our specific example above, we’d have the following structure:
- Event Category
- Event Action
- Event Label
Rule #2: Use a naming convention that’s easy to understand
This goes for each section of the Measurement Plan and GTM architecture alike.
Not wasting time in understanding the purpose of each setup is a blessing for all those who work on data implementation, data analytics, and anything that includes leveraging data.
So, keep things clean, structured, and easy to understand.
As you can see below, here at Growth Savvy, we tend to obsess over structures and the UX of each output we build.
EachGTM concept has its naming convention.
Naming Convention for Tags:
[Page or Section] [Number of item in Measurement Plan] [Short description] – [Type of Tag]
- Homepage 1. Social Share – UA
- Blog 3. Click on Article – UA
- Global 1. Scroll Depth – UA
Naming Convention for Triggers:
[Page or Section] [Number of item in Measurement Plan] [Short description] – [Type of Trigger]
- Blog 3. Click on Article – Click
- Global 1. Scroll Depth – Scroll Depth Event
- Contact 4. Form Submit – Custom Event
Naming Convention for Variables:
[Type of Variable] – [Short Description]
- JS – Social Media Type
- DataLayer – Page Name
- Constant – UA Tracking Account ID
Rule #3: Create a seamless GTM folders structure
Do not, under any circumstances, let GTM automatically arrange your folder structure!
By default, Google Tag Manager creates a general folder named ‘Unfiled Items’ for every single element.
You don’t want that!
You want to have all your tags, triggers, and variables in folders arranged by type.
Our suggestion is to consider structuring your implementations by the folders you see below.
- Folder for Pageview – Pageviews
- Folder for Events – Events
- Folder for Variables Variable – [Type of Variable] (e.g.: DataLayer, Custom JS, Constant)
- Folder for Custom HTML Tags – Custom HTML
- Folder for 3rd Party Tags – Third Party
Rule #4: Keep the IDs and classes unique
Having unique IDs and classes to help you track data is vital – otherwise, it’s impossible to have any accuracy.
One way to do it is to use an element’s ID or a specific class.
However, the best practice is for the HTML to include a custom attribute – such as “analytics-click-action,” where you include all the meaningful information.
Let’s go back to the example of tracking the clicks on the Facebook share button. In this instance, using the ‘Social Media Button – Click’ as our unique class would be a safe approach. Since it’s social media, we know that no other button from our website will have that class.
But let’s imagine we used a different class, like ‘button’ or ‘btn.’ Can you see why that would not be a smart move? It’s because there is a very high probability that other buttons – which we do not want to track – would use this class as well. This would wreak havoc on our measurements. And without reliable data, you cannot expect to make good decisions.
Rule #5: Leverage data layers wherever you can
One of the most important sources of information for GTM is the dataLayer.
What’s its unique power?
It helps you store all the information you need on the page so you can use it anytime.
Assume you are in charge of a publishing website similar to Forbes.
Your 200 writers are constantly publishing content for 3 different business categories: Leadership, Money & Business.
Wouldn’t it be cool to go to Google Analytics and check the author and/or category’s content performance?
Think of all the ways this insight could help you boost your website’s revenue by focussing on the category that generated the most profit. Or how you could suddenly discover that that very-well paid collaborator is contributing little to none towards helping you reach your revenue goals.
2. How to grow a business by following the golden data-trail
Let’s see an actual example on the data activation side and how the fictional publishing website we mentioned above can grow by tracking this data type.
We know certain topics, authors, and writing styles attract more people. Knowing exactly which is which would open up a whole new universe of possibilities.
For example, we could try dynamic retargeting ads based on interests and preferences. Or we could decide to scale up on a type of content that we know for a fact drives in more traffic and conversions. We could even emphasize that subject on our homepage to drive up engagement or create a video around it.
Doesn’t this get you excited about all the possibilities out there? This is the power data holds.
When guided by reliable and actionable data, the world becomes your oyster. The more quality data you can pull from the dataLayer, the better.
Now let’s get technical and see how you can actually gather this data.
So, we know what we want to track and why (content performance based on author and category).
Now let’s assume that our article is written by ’Michael M,’ and he writes about Analytics topics.
So, we want to store this info inside a data-layer and send it to Google Analytics.
Step #1: Collect Information
As you can see, the dataLayer can contain essential information and is very easy to collect in GTM.
All you need to do is:
- Create a new Variable and select Data Layer Variable type
- Insert the key to the information (author in our case)
Now that you have the variable that collects that information, you can use it in a tag or a trigger as a condition.
Step #2: Add variable to Tag
There are 2 ways in which you can add a dataLayer variable in your implementation.
- Data Layer type variable as a custom dimension in Google Analytics Settings Variable (this way, you will add that custom dimension for every tag that uses that GA Settings variable)
- Data Layer type variable as a custom dimension in a specific tag. In this case, only that tag will contain the new dataLayer variable based custom dimension.
Step #3 – Extra: Triggers based on dataLayer
As we’ve already mentioned:
- You can add that Data Layer type variable as a condition to a trigger…
- … but, you can also create a trigger based on a custom dataLayer event.
The example we show here is measuring form success – the number of users who successfully submitted a form compared to the total number of users who have seen it.
You want to create your Custom HTML tag that will return the line of code shown below when the conditions of successfully submitted forms are met.
And this is how your trigger should look like after:
Having all of your information together is like the Holy Graal of Tracking. Building a solid scalable foundation and easily keeping track of every change and update shouldn’t feel like a burden — and it won’t if you do it mindfully and well-organized.
We’ve put together the Measurement Plan Template that will ease your life and help you stay in control.
For now, the Measurement Plan is focused on UA, and we’ll soon release the GA4 Measurement Plan as well (you’ll receive the new version as a free upgrade if you download the current one).
The definitive guide for building a solid GTM architecture that saves you time and money
A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4
Accelerate Your Data Analysis Process & Generate Insights up to 90% Faster With the Right URL Architecture