Google Tag Manager: A Simple Tutorial

How to Use Google Tag Manager: The Comprehensive Guide for 2024


Collecting data is crucial for the success of any digital marketing strategy. Insights gathered from website analytics help you better understand your audience, optimize your campaigns, and grow your business online. However, implementing tracking code on your site can be a tedious and complex process, especially for marketers without technical expertise.

Enter Google Tag Manager. This free tool makes it easy to deploy and manage various marketing tags (snippets of tracking code) on your website without needing to edit the underlying source code. Whether you want to track Google Analytics events, Google Ads conversions, or other custom data points, Google Tag Manager has you covered.

In this comprehensive guide, we‘ll dive deep into what Google Tag Manager is, how it works, and step-by-step instructions for using it to streamline your tracking setup. Let‘s get started!

What is Google Tag Manager?

Google Tag Manager (GTM) is a free tag management system that allows you to quickly and easily update tags and code snippets on your website or mobile app. Tags are used to collect data and send information to third-party tools, like Google Analytics.

Instead of having to manually add tags to each individual page of your website, GTM allows you to host tags in one centralized location (a "container") and fire them based on certain triggers and rules you define. This not only makes your tracking setup cleaner but also reduces the risk of errors.

Key benefits of using Google Tag Manager:

  1. Increased efficiency – Marketers can add and update their own tags without having to involve developers each time.

  2. Faster load times – GTM loads asynchronously and can improve site speed compared to having numerous tags scattered throughout the page.

  3. Better organization – All third-party tags and tracking codes are neatly contained within GTM, making them easier to manage.

  4. Enhanced security – GTM includes built-in security features and gives you more control over what data is collected on your site.

Setting up Google Tag Manager

To start using Google Tag Manager, you‘ll need to create an account and container for your website. A container is basically a bucket that holds all the tags, triggers, and variables for a given site.

Step 1: Create a Google Tag Manager account
Go to and click the "Sign Up for Free" button. You‘ll be prompted to enter an account name (e.g. your company name) and select whether you‘ll be using GTM for a website, iOS app, Android app, or AMP pages.

Step 2: Set up a container
After clicking continue, you‘ll need to specify a container name (usually your website name) and enter the URL of your website. Accept the terms of service and click "Create".

Step 3: Install the GTM code on your site
Next you‘ll get a pop-up window with your new GTM container‘s installation code snippets. There are two codes you need to add to your website:

  • The first code snippet should be pasted as high as possible in the section of your page.
  • The second snippet needs to be added immediately after the opening tag.

If you have access to your website‘s source code, you can add these directly. Otherwise, many popular CMS platforms like WordPress have plugins that can inject the code for you. Once the code is installed, click "OK" to close the popup.

Congratulations, you‘ve successfully set up Google Tag Manager on your site! You can now access your container dashboard and start configuring tags.

The GTM User Interface

Before we dive into creating tags and triggers, let‘s take a quick tour of the Google Tag Manager interface. Here are the key components you should know:

Overview – This is the main dashboard view where you can see recently edited containers and a high-level snapshot of published versions.

Workspace – This is like a staging area for your container where you can create and test versions before publishing them live. Multiple users can have their own workspaces.

Tags – Here you can configure the various types of tags you want to deploy on your site (Google Analytics, Google Ads, custom HTML, etc.).

Triggers – Triggers are rules that define when and where your tags should fire (on page load, button click, form submission, etc.).

Variables – Variables are additional pieces of information GTM can use in your tags and triggers, like data pulled from URLs or your website‘s data layer.

Versions – As you make changes to your container, GTM saves them in versions. The Versions tab shows a history of all container versions and allows you to publish or rollback to previous ones.

Admin – The Admin section contains general settings for your GTM account and container, including user permissions, container import/export, and more.

Creating Your First Tag

Now that you‘ve got Google Tag Manager installed on your site and are familiar with the interface, let‘s walk through creating a basic Google Analytics pageview tag.

Step 1: Create a new tag
In your workspace, click the "Add a new tag" button. Give your tag a descriptive name like "GA – Pageview".

Step 2: Choose tag type
Click anywhere in the "Tag Configuration" box to open the tag types panel. Here you‘ll see dozens of tag templates for common tools and use cases. Find "Google Analytics: Universal Analytics" and select "Page View".

Step 3: Configure tag settings
Now you‘ll need to specify which Google Analytics property this tag should send data to. The easiest way is to paste your GA tracking ID (in the format UA-XXXXXX-X) into the "Tracking ID" field.

Step 4: Set a trigger
Next, scroll down to the "Triggering" section. This determines when your tag will fire. In this example, we want the pageview to trigger on all pages, so choose the built-in "All Pages" trigger.

Step 5: Save the tag
Click the blue "Save" button in the upper right to save your new pageview tag.

And that‘s it! You‘ve just configured your first tag in Google Tag Manager. Of course, this is just the beginning – GTM supports an almost endless variety of tag types and configurations. But the basic process of choosing a tag type, configuring its settings, and defining a trigger remains the same.

Advanced GTM Features & Use Cases

As you get more comfortable with the basics of Google Tag Manager, you can start exploring some of its more advanced capabilities:

  1. Data Layer
    The data layer is a JavaScript object that you can use to pass information from your website to GTM. This allows you to collect and use custom data points in your tags and triggers. For example, you could use the data layer to track details about products added to cart, lead form submissions, or user login status.

  2. Custom Events
    In addition to the basic page view trigger, you can set up custom event triggers to fire tags based on specific user interactions. Examples include clicks on certain links, scrolling to a particular page depth, or playing a video. Custom events give you much more flexibility in what and how you track.

  3. Dynamic Remarketing
    If you run Google Ads, you can use GTM to implement dynamic remarketing on your site. This allows you to show customized, product-specific ads to users who previously visited your site, based on the actual products they viewed or added to their cart. GTM makes it relatively easy to add the required remarketing tags and feed GoogleAds the necessary product data.

  4. Cross-Domain Tracking
    For businesses that span multiple domains, GTM can help you set up cross-domain tracking in Google Analytics. This ensures that sessions and conversions are tracked accurately as users navigate between your different sites. GTM simplifies the process of adding the needed code modifications.

  5. A/B Testing
    While not a replacement for dedicated A/B testing platforms, GTM can be used to run simple split tests. For example, you could use it to test different versions of a Call-to-Action button and measure differences in conversions. GTM‘s tags and triggers make it easy to randomize users and implement the test variations.

Tips for Success with Google Tag Manager

  1. Use clear naming conventions: As your container grows in complexity, it‘s critical to adopt consistent naming schemes for your tags, triggers, and variables. A good format is to include the tag/trigger type, a unique identifier, and optionally a version number. For example: "GAEvent – CTA Click v1".

  2. Leverage folders: Folders are a great way to keep your workspace organized. Consider creating separate folders for different tag categories (e.g. Google Analytics tags, marketing pixels, custom tags etc.)

  3. Test thoroughly: Always use the Preview mode to test new tags before publishing to production. You can load your site with GTM‘s debugging panel open to check that tags are firing as expected.

  4. Implement an approval process: For larger teams and enterprises, it‘s smart to implement a formal QA and approval workflow for new GTM versions. This minimizes the risk of inadvertent bugs or broken tracking. Features like workspaces and user permissions make this easier.

  5. Monitor for errors: Keep an eye on your GTM and Google Analytics accounts for any signs of errors or unusual data fluctuations after publishing a new container version. Act quickly to pause or rollback versions that may be causing issues.

  6. Keep learning: GTM is a powerful tool with a lot of depth. Make a habit of staying up-to-date on new features and use cases. Google‘s official documentation and analytics blogs are great resources. Taking the free Google Analytics and GTM certification courses can also boost your skills.


We‘ve covered a lot of ground in this guide, from the basics of setting up Google Tag Manager to some of the advanced tracking and optimization use cases it enables.

The main takeaway should be that GTM is an incredibly valuable tool for marketers and analysts who want more control and flexibility over their websites‘ data collection. While there is a learning curve, the efficiencies and insights GTM can bring to your tracking setup is well worth the effort.

By implementing the concepts and best practices covered here, you‘ll be in a great position to take your data-driven marketing to the next level. So go experiment with tags, triggers, and variables to capture the data points that matter most to your business. The clearer view you have into your user behavior and marketing performance, the smarter decisions you can make to optimize and grow.

Happy tagging!