Google Tag Manager Tutorial: How to Set Up Google Tags

Written by Coursera Staff • Updated on

Learn how to set up Google Tag Manager, a free, online tool for tracking online activity.

[Featured image] A Woman wearing a pink blazer sits at her desk, setting up her Google tags.

Creating a Google Tag Manager account in Google Analytics can help you collect valuable information about your website. Using tags, you can track where people come to your site from and what they do once there. These tracking activities include scrolling, PDF file downloads, link clicks, and video plays. You can also generate heat maps or monitor form submissions. In this Google Tag Manager tutorial, you’ll learn how to set up your account to analyze Google products or various third-party services.

How to set up Google Tag Manager

This quick summary outlines the steps you’ll take to set up Google Tag Manager:

  1. In Tag Manager, create a new account and container.

  2. Install the container.

  3. Configure your tags.

  4. Confirm your tags work.

  5. Publish your tags.

Let’s take a more detailed look at each of these steps to help you manage your tags.

Step 1: In Tag Manager, create a new account and container.

To begin, in Google Tag Manager (GTM), click on the Create Account button to create a new account and container.

First, you will set up the GTM account by naming it and selecting the country for the account from a drop-down menu.

At this point, you can also choose to share data anonymously with  Google and others. If you check the box to allow sharing, your data, scrubbed of identifiers, gets added to Google’s benchmarking metrics.

Next, you enter a descriptive Container name to help you differentiate between this and other containers. Choose the target platform on which you will use your tags, which could be a website, Accelerated Mobile Page (AMP), Android or iOS app, or a server. 

Select your target platform, click Create to create the account and container, and agree to Google’s terms.

Note: To collect metrics from multiple platforms, you’ll need to create containers for each one.

Step 2: Install the container.

Your new container will load with a different dialog box according to the type of container you selected. If you are working with web and AMP, you’ll see the installation code for your website.

Paste the provided code snippets into your website or AMP. You’ll put the first code snippet, which reads <script>, as close to the opening <head> tag as you can. As long as it’s below any dataLayer declarations.

Put the second <noscript> code snippet after the <body> tag on your web pages.

Note: For iOS and Android, you get a link to the developer documentation. If you select the server platform, you can provision that automatically or manually. If you do not feel confident installing code on your own, consulting with a developer is a good idea.

Step 3: Configure your tags.

Clicking OK in the code snippet dialog box will take you to your GTM workspace. There, you can set up your tags. Click on Add a new tag.

On the next screen, you’ll name your tag. Then, you’ll be asked to configure the tag and set up triggers. Let’s start with Tag Configuration. Click on Choose a tag type to begin setup… to see a sidebar menu of tag options. These options include Google products and third-party tags.

You’ll need to enter information to configure your selected tag type. For example, for Google Analytics GA4 Configuration, you’ll provide your Google Analytics tracking code as the Measurement ID. You’ll be given the tracking code when you set up your Google Analytics account.

Some third-party tag options include:

  • AdRoll

  • Bizrate Insights

  • Crazy Egg

  • FoxMetrics

  • Hotjar

  • LinkedIn

  • Mouseflow

  • Quora Pixel

  • Shareaholic

  • Upsellit

  • Yieldify

Note: Not all tags are supported on all platforms. See Google’s list of supported tags and platform types. More experienced users could also create a custom HTML or image tag.

Triggering lets you define what happens when. Each tag requires at least one trigger to fire. 

For instance, you might set up a tag to fire when a certain page loads or when someone clicks a button.

Clicking on Choose a trigger to make this tag fire… takes you to a new page with options for that trigger. For example, a page view trigger might take you to a screen showing:

  • All Pages

  • Consent Initialization — All Pages

  • Initialization — All Pages

With All Pages, your tag triggers by default on all pages. Use Consent Initialization for tags that set or update your site's user consent settings. Meanwhile, Initialization—All Pages fires any tags that should fire before other triggers.

You’ll find many built-in variables for different trigger types. Plus, you can configure custom variables, too.

Click Save to add your tags.

Step 4: Confirm your tags work.

Return to your workspace to test your changes. Start by clicking on Preview in the upper right of the dashboard.

Google Tag Assistant launches in a new tab. You’ll enter the URL for the website where you installed the GTM container. Click Connect.

Any errors? Use Tag Assistant to debug. Or you may need to edit a tag. You can click on that tag’s name to change its configurations. For example, you may want a tag to trigger after someone clicks a button instead of after a page loads.

Save any changes, then verify you solved any issues by launching Preview mode again.

Step 5: Publish your tags.

Once you have confirmed your tags work as you intended, you can publish them by clicking Submit at the top right of the screen (beside Preview).

On the Submit Changes screen, next, you can select Publish and Create a Version to push the changes to your site. Otherwise, you can Create a Version to only save changes and create a new version.

Enter a Version Name and provide a Version Description. The more detailed you are in the Version Description box, the more useful this information will be in the future for understanding your version changes.

Click Publish to complete your work on this GTM account, container, and its tags and triggers.

Learn more with Coursera

This Google Tag Manager tutorial offers a basic overview of the free tool for site tracking. Learn more about the power of GTM and Google Analytics with the Google Digital Marketing & E-commerce Professional Certificate on Coursera. Gain the skills you need to pursue your career in this learn-at-your-own-pace program.

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.