What is Google Tag Manager and how do I set it up?

GTM for beginners

Google Tag Manager (GTM) is a free tool from Google that allows you to track all events within your website and manage all your tags in one location. These marketing tags, small code snippets that record user actions and collect data, are important for monitoring interactions on your site. In this blog, we take you through everything you need to know about Google Tag Manager to understand it and get started yourself.

What is Google Tag Manager and how does it work?

Google Tag Manager allows you to track user interactions on your website through tags. A common example of a marketing tag is the Google tag, which is used to install Google Analytics and other Google products and services. In addition, Google Tag Manager also allows you to Administer other tracking tools such as Meta or Hotjar. The advantage of this is that you administer everything from one central point, eliminating the need to add separate HTML codes to your website for each platform. For Google Tag Manager, you only need to add code once, after which you can Admin tags and triggers in Google Tag Manager for all platforms to send user data to these platforms.

Some important terms you need to know when you start using Google Tag Manager

  • Tags are pieces of code that collect or activate information on your website. Here you can ask yourself what kind of code you would want to send/collect. Examples of tags include Google Analytics, Google Ads Tags, Meta-pixel, etc.
  • Triggers are conditions that determine when a tag should be activated. Examples of triggers are page view, click and form submission.
  • Variables can be used to pass information to tags or triggers. These values that may change depending on the context.
  • Container: The container is where your tags/triggers and variables reside.
  • Preview mode: In preview mode, settings can be tested before going live.
  • Datalayer: The datalayer contains information about an action that takes place. For example, price, quantity or product details.

What is Google Tag Manager used for?

Google Tag Manager retrieves data, structures it and forwards it to relevant platforms. For example, you can use Google Tag Manager for:

  • Measuring user data such as purchases
  • Tracking of form submissions from your B2B website
  • Campaigns
  • Remarketing

What exactly does the data flow look like?

how-does-a-data-layer-works

To illustrate how a data stream works, let’s look at measuring a GA4 purchase on a Web site. The process starts as soon as a user completes a purchase on the website. This action and its associated data are stored in a structured manner in the Data Layer. This Data Layer contains variables that contain information from the purchase, such as product details, price and quantity.

These variables are then used to set up triggers. A trigger defines the moment when a tag should be activated. In this case, a trigger is set up that responds to the purchase, detected by the relevant variables in the Data Layer. Depending on this trigger, a specific tag can then be set up and setup, such as a GA4 purchase tag. This tag is activated as soon as the conditions of the trigger are met, i.e., when a purchase is made. This allows the purchase action to be accurately measured and recorded in GA4.

If you want to know more about the datalayer read our blog where we explain everything about the Google Tag Manager Data-Layer.

Structured data

In addition, Google Tag Manager can also be used to implement structured data on your website. Structured data is an extra layer of data that you add to your pages in a specific format. This makes it easy for Google to include this information in search results, which naturally causes people to click on your result!

Structured data

Server Side Tracking in conjunction with Google Tag Manager.

What is Server side tracking?

Server Side Tracking is a new way of collecting data. You set up your own server that collects data from your website. This makes you the owner of the data collected. Through this server, you then invoke Google Tag Manager. This process of data collection and transmission is known as Server side tracking.

Web and server container

So you Admin all your tags and triggers in one container. When you use Server Side Tracking, an additional container comes with it – the server container. Briefly, a Webcontainer collects data via tags that are sent directly to the user’s browser. With a server container, on the other hand, the data first goes to a server, where you then determine which data is forwarded to which platforms, such as Google Analytics. Currently, many companies still use a method where data first goes to the webcontainer and from there is routed to the server container. However, this process is subject to change, mainly due to new laws and regulations.

Server Side tagging explanation

Server Side Google Tag Manager.

Google Tag Manager works well in conjunction with Server side tracking. Google has even created a special version of Google Tag Manager, Server Side Google Tag Manager (SGTM). The benefits of using sGTM are:

  1. Bypassing Ad Blockers and Tracking Prevention
    • Avoid blocking ad blockers and tracking prevention in browsers.
    • Place first-party cookies, even if users block third-party tracking.
  2. Improved Data Quality
    • Enrich and anonymize data as you see fit.
    • Collect and send user data to ad platforms for better targeting.
  3. Faster Website Load Time
    • Scripts load on the server instead of in the browser, which improves website loading speed.
    • Improved loading speed has a positive effect on conversion rates and SEO ranking.
  4. Extended Cookie Lifetime.
    • Extend cookie life in browsers with tracking prevention.
    • Make sure conversions are attributed correctly even if they occur later.
  5. More Effective Retargeting
    • Bypass tracking prevention to extend cookie life.
    • Improve the effectiveness of retargeting campaigns by tracking users more accurately.
  6. GDPR Compatibility.
    • Collect and Admin your own data, which is more in line with GDPR guidelines.
    • Customize and anonymize data before sharing it with third parties.
  7. Increased Security
    • Data is processed on your own server, making it better protected from misuse.
    • Prevent spam by setting up special filters for server-side data processing.

Measuring a purchase event with Google Tag Manager?

The following steps explain how to create a Google Tag Manager account and link it to your website. Next, an example explains how to set up a tag, trigger and variable. The example in this case is measuring a purchase. We want to make this conversion insightful in Google Analytics: GA4. So to reproduce this example, it is important that you already have Google Analytics configured for your website.

Create a GTM account and container

If you have not used Google Tag Manager before, you must first create an account. To do so, go to the Google Tag Manager website and select the blue Get Started Free button. You will then be asked to set up an account and container. So for now, we will assume that you have a business with one website. Name your account, select the country, name the container (your website name), select Web as the target platform and click Create.

add-new-account-google-tag-manager Google Tag Manager

Place the Google Tag Manager code on your website

After creating an account and container, you will be given two pieces of code to place on each page of your website. This is the container code. You can do this manually, but this can also be done, for example, by adding a plugin / addon to your website. We have built plugins / addons for several CMS systems that allow you to easily place the Tag Manager script on your website allowing you to use Google Tag Manager. The advantage of these plugins / addons is that it is user-friendly and also automatically adds a datalayer to your website.

For example, should you be using WordPress, you can use the TAGGRS WooCommerce Data Layer plugin.

google tag manager code

Installing Data Layer

A Data Layer structures all the data coming from your website, which can then be used in Google Tag Manager for variables, tags and triggers. In practice, this means that for every action on your website, such as a purchase, the Data Layer records this including specific information such as product name, price and quantity. You need this information to set up your tags, triggers and variables in Google Tag Manager. So setting up a datalayer is an essential.

In some cases, a datalayer is not necessary. This applies, for example, when you want to measure only B2B events. In that case, you can use the default Tags and Variables in Google Tag Manager. For ecommerce events, however, it is necessary to have a datalayer. To see which built-in events the Google Tag can automatically pick up, look under Variables under Built-in Variables. Click Configure to see the available options. Next, select the variables relevant to your tracking needs.

Configure-Built-In-Variables-GTM

Data Layer needed? An easy way to add a datalayer is to use one of the TAGGRS plugins. If you want to know more about exactly how the datalayer works check out our blog on Google Tag Manager Datalayer.

Set up Google Tag setup through which data flows from GTM to GA4.

To send the collected data to Google Anayltics 4, you must first set up the Google Tag setup. You can do this using the following steps.

Step 1. Find your Google Analytics 4 measurement ID.

  • Log in to Google Analytics 4
  • Click on admin
  • select your property
  • click on data stream
data stewam collection
  • Click on the data stream
Data stream
  • Under stream details, you see the measurement ID on the right.
GA4 stream ID

Step 2. Go to Tags and then click New.

Create Tags

Step 3. Google Tag Configuration Give the new tag a name, for example GA4 Configuration, and click Tag Configuration. Choose Google Tag as the tag type. Next, enter the Tag ID you created in step 1. Then, under Configuration parameter, enter the following: send_page_view : true

GA4 tag config logo

Step 4. First, navigate to the Triggers section and select Initialization – All Pages. After adding this option, save the changes by clicking Save in the upper right corner. You now have the GA4 Tags installed. Don’t forget to put the container live, by clicking send at the top right.

GA4 tag-trigger-logo

Tag setup and triggers.

Now that you’ve linked Google Tag Manager to your website, it’s time to set up Tags and Triggers. In this step, we explain how to set up the Tag and trigger for measuring a purchase.

Tag setup

Step 1. In your workspace, click Tags and then click New at the top right.

Create Tags

Step 2. Select the tag type GA4 event. By choosing this type, you make it possible to measure and capture specific user interactions, such as purchases, directly in Google Analytics. Next, name your tag in the upper left corner. Next, enter your GA4 measurement ID that you looked up earlier when you installed GA4.

Select event type

step 4. In this step, we are going to set up a trigger. For convenience, we now use a thank you page as a trigger. Want to take advantage of events like a purchase event? Then check out our blog on (E-commerce) Events creation in Google Tag Manager. Choose a trigger to fire this Tag. If you want the Tag to fire when a certain page is visited, use the following trigger.

Trigger Configuration > Trigger Type: Page View > Some Page Views.

Select trigger
Choose trigger type

Since you want the Tag to be fired on a specific page, for example the thank you page, you now need to add a specific trigger. Tip: Give the trigger a distinctive name so you can easily recognize it.

To do this, set the following:

Page Path contains:/Thank-you-for-your-order. (This is where you enter the page path of the page you want to measure.

After this, click Save.

Set path

Step 5. Test your Tags! This is very important because even a small spelling error will cause your Tags to not work. Testing can be done in preview mode. This option is in the upper right corner of your Google Tag Manager workspace. Once you click on this, a new tab of Tag Assistant will open, where you need to enter your website’s URL.

Next, go to the page where the tag should be fired. So in case you want to measure a purchase, you have to make a test purchase while in preview mode. Then in Google Tag Manager preview mode, see if the Tag was indeed fired. In the example below, the name of the purchase Tag is Ecom Events. So this should be under Tags fired.

GTM-preview-tags-fired-logo

Step 6. When you have tested your Tag and it works, you can go ahead and publish the Tag. To do this, click the blue Submit button in the upper right corner. This opens a new tab where you can include information about the new version you want to publish. Enter a descriptive name here so that in case Tags do not work you can easily find where it went wrong. Once you have completed these steps, you are going to publish the Tags. To do this, click Publish in the upper right corner. Your Tags are live and collecting data from that point on.

publish

Step 7. Look in Google Analytics to see if conversions are being measured correctly. This could look like this.

GA4 events

It was! – Google Tag Manager setup

You now have the basics in place and are ready to optimize your Google Analytics: GA4 Configuration. You know how to set up events in GA4, how to ensure that every interaction on your website is measured correctly, and how this data is displayed in Google Analytics. You are now ready to start setting up more platforms within Google Tag Manager. In your TAGGRS dashboard, you will find implementation manuals for the most popular platforms.

Always test your setup to ensure that all events are triggered correctly and that the data appears accurately in your reports. Good luck adding more Tags and triggers!

taggrs-software-implementation

Server Side Google Tag Manager (SGTM).

After you configure Google Tag Manager in the Web container, the next step is to set up GTM Server Side Tracking. This starts with setting up Server Side Google Tag Manager for your various platforms. At TAGGRS, our experts have created specific templates for the most popular platforms. You can easily download these from the TAGGRS Template Gallery, which is available through your TAGGRS Dashboard. These templates enable you to quickly and flawlessly implement Server Side tracking on familiar platforms. For more information on these templates and how to apply them, read our blog on the TAGGRS Template Gallery.

taggrs-template-gallery

At TAGGRS, we will guide you from start to finish in configuring your Google Tag Manager so that you can ultimately measure all of your website’s user data effectively.

Tip: If you have set up Server Side via TAGGRS, you can see within the TAGGRS Dashboard how much additional data you are getting in through Server Side Tracking!

taggrs-tracking-tags-server-side-analytics

What you know now

After reading this blog about Google Tag Manager (GTM), you now have a good understanding of what it is and how it works. GTM is a useful tool for Administering marketing tags and tracking user interactions on your website. You learned how to set up tags, triggers and variables and how to send collected data to platforms such as Google Analytics: GA4. In addition, you’ll know how to test your Google Tag Manager set-up in preview mode before going live to make sure everything is working correctly. You’ll also know how to set up Server Side Tracking in Google Tag Manager and the benefits of Server Side Tracking, such as better data control and GDPR compliance. After reading this blog, you will have the necessary knowledge and steps to get started with GTM yourself, including tips for optimizing your tracking setup.

Frequently asked questions Google Tag Manager


Can you use Server Side Tracking without Google Tag Manager?

Theoretically, this is possible, only you need to set up your own Tag structure like that of Google Tag Manager. But this is not common.

I already use Google Tag Manager, do I need to reset everything now to use Server Side Tracking?

No, this is not necessary. You can continue to use your already set up Tags and triggers; these can be customized to work with Server side tracking.


About the author

Ate Keurentjes

Ate Keurentjes

Server Side Tracking Specialist at TAGGRS

Ate Keurentjes is a Server Side Tracking specialist at TAGGRS. He has experience with various Google Tag Manager concepts. Keurentjes has been editing and writing about the latest developments and trends in data collection / Server side tracking since 2023.

Ready for the next level?

Start with Server Side Tracking and generate more revenue and conversions in a world without third-party cookies.