Logotipo do Blog Hotmart
  • Content creation
  • Affiliate marketing
  • Authorities Portal
    • Digital marketing
    • Content creation
    • Entrepreneurship
    • Affiliate marketing
    • Digital products
    • Hotmart
  • Português - Brasil
  • Español
  • Français
Sign up for free
  • Content creation
  • Affiliate marketing
  • Authorities Portal
    • Digital marketing
    • Content creation
    • Entrepreneurship
    • Affiliate marketing
    • Digital products
    • Hotmart
Sign up for free
Illustration of Google Tag Manager: on a light background in isometric view, tags come out of an open container box, the orange one is the tag that fired, wired to pie, line and bar charts with gears alongside

Digital marketing

Google Tag Manager: what it is, what it’s for and how to install and set up GTM

A guide to Google Tag Manager: what GTM is, how tags, triggers, variables and the data layer work, how it differs from Google Analytics and gtag.js, how to install it step by step, set up GA4 and events, test and publish, Consent Mode v2, server-side tagging and how to use it on a digital product's sales page and checkout.

Lara Azeredo

12/04/2026 | By Lara Azeredo

What will we see in this post

Index
What is Google Tag Manager (GTM)? What Google Tag Manager is used for How Google Tag Manager works: account, container, tags, triggers and variables Google Tag Manager vs. Google Analytics vs. the Google tag (gtag.js) How to install Google Tag Manager: step by step How to use Google Tag Manager with GA4: the Google tag and events Google Tag Manager Preview mode: how to test and publish Consent in Google Tag Manager: Consent Mode v2 and privacy laws Server-side tagging in Google Tag Manager: the short version How to use Google Tag Manager on a digital product’s sales page and checkout Common Google Tag Manager mistakes Frequently asked questions about Google Tag Manager
Back to index.

Every time you want to track a click on your buy button or install an ad platform’s pixel, the same question comes up: do I have to touch the code again? 🤔 Google Tag Manager exists for exactly that: you install one snippet once and, from then on, manage everything else from a dashboard.

In this guide, you’ll learn what Google Tag Manager (GTM) is, how it works, how to install it, how to set up GA4 and events, how to test before publishing and how to handle consent. At the end, there’s a section for anyone selling digital products. ✅

Question Quick answer
What is Google Tag Manager? A free Google system for managing your site’s measurement and marketing tags without editing the code every time
Does GTM replace Google Analytics? No: GTM installs and fires the tags; Google Analytics receives the data and builds the reports
How do you install Google Tag Manager? Create an account and a container at tagmanager.google.com and paste the container code into your site’s head (or use your platform’s integration)
Do I need to know how to code? Not for the basics: Google tags and many third-party tags have ready-made templates; the data layer and custom tags take more know-how
How do I know a tag works? In Preview mode (Tag Assistant), before you click Submit and publish

What is Google Tag Manager (GTM)?

Google Tag Manager is Google’s tag management system that lets you set up and update the tracking code on a website or app from a web interface, without changing the source code every time. You install one snippet, the container, and then manage your tags from the dashboard.

Google launched Tag Manager on October 1, 2012, according to the announcement on the Google Analytics blog, as a free tool that consolidates a site’s tags into a single snippet. It’s still free, according to the Tag Manager page on Google Marketing Platform, which also offers a Tag Manager 360 version.

A tag is a piece of code that collects or sends data, such as the Google Analytics 4 tag, the Meta pixel or the Google Ads conversion tag. With GTM, they all live in one place. GTM is part of your web analytics setup: it doesn’t analyze anything, it makes sure the right data reaches your analytics tools.

What Google Tag Manager is used for

Google Tag Manager is used to install, organize and control your site’s tags on your own, quickly and safely. In practice, GTM lets you:

  • install tools without a developer: Google Analytics 4, Google Ads and social media pixels;
  • track actions your site doesn’t record on its own: button clicks, form submissions and clicks on chat or WhatsApp links;
  • feed ads and audiences: conversions for Google Ads and remarketing lists;
  • test and roll back: Preview mode shows what fired, and every publish creates a version you can restore;
  • control who makes changes: different permissions for each person.

For marketers, the biggest win is speed: a new tag goes live in minutes.

How Google Tag Manager works: account, container, tags, triggers and variables

Google Tag Manager works like this: tags fire when a trigger condition is met, and triggers and tags use variables, which can come from your site’s data layer. All of this lives inside a container, which belongs to an account. The main building blocks are:

  • account and container;
  • tags;
  • triggers;
  • variables;
  • data layer.

Understanding these terms gets you halfway to using GTM with confidence.

Account and container

The account is the top level in Google Tag Manager and, according to the Tag Manager Help Center, Google generally recommends one account per organization. Inside it are the containers: a container is the set of tags, triggers, variables and related settings installed on a website or app, and you usually have one container per site. Container types are Web, iOS, Android, AMP and Server.

Tags

Google Tag Manager tags are the tracking codes that send data to another tool. GTM includes templates for Google products (Google Analytics, Google Ads, Floodlight), templates from other companies in the Community Template Gallery and the Custom HTML tag, for pasting any script.

Triggers

Google Tag Manager triggers define when a tag fires, and every tag needs at least one trigger. The list of trigger types includes page view, click, element visibility, form submission, scroll depth, YouTube video, custom event, history change, JavaScript error, timer and trigger group. Each trigger can have conditions: for example, fire only when the click text contains “Sign me up”.

Variables

Google Tag Manager variables store values that change as people browse, such as the page URL, the text of the clicked button or the value of a purchase. There are built-in variables (Page URL, Click Text, Form ID) and user-defined variables, such as a constant holding your GA4 ID.

Data layer

The data layer is the object Google Tag Manager and the Google tag use to receive information from your site, according to Google’s developer documentation. The site sends an event and any data it wants with the dataLayer.push command (for example, the “purchase” event with value and currency), and GTM uses that data in variables and triggers. This part is usually handled by a developer.

Diagram of how Google Tag Manager works, with the container, tags, triggers, variables and data layer working together to fire the tags on your site.

Google Tag Manager vs. Google Analytics vs. the Google tag (gtag.js)

Google Tag Manager installs and fires tags; Google Analytics receives the data and shows the reports; the Google tag (gtag.js) is code you paste straight into your site that sends data only to Google products. According to Google’s tagging documentation, the Google tag suits people comfortable changing JavaScript on their site, and Tag Manager suits people who want to manage tags without changing code.

Google Tag Manager Google Analytics 4 Google tag (gtag.js)
What it is Tag management system Analytics and reporting tool Google measurement code
What it’s for Installing and firing tags from any tool Showing traffic, events and conversions Sending data to Google Analytics and Google Ads
Third-party tags Yes, including Custom HTML Not applicable No
Changes In the dashboard, with versions In the GA4 dashboard By editing the site’s code

In practice, they work together: GTM loads the Google tag, which sends data to GA4 (to learn how to read the reports, see our Google Analytics guide). If your site already has gtag.js and you’re moving to GTM, remove the old code so nothing gets counted twice.

How to install Google Tag Manager: step by step

Installing Google Tag Manager takes a few minutes and has two stages: create the account and container, and add the container code to your site. You need a Google Account and access to your site’s code or your platform’s dashboard.

1. Create the account and container

According to the Tag Manager Help Center, the steps are:

  1. go to tagmanager.google.com and sign in with your Google Account;
  2. on the Accounts tab, click Create Account;
  3. enter the account name (your company) and country;
  4. under Container Setup, use your site’s address as the name (www.yoursite.com) and choose Web;
  5. click Create and accept the Terms of Service.

The container gets an ID that starts with GTM-, shown on the Workspace tab.

2. Install the container on your site

On the Workspace tab, click Install Tag Manager. The Help Center article on installation shows two paths:

  • platforms and CMSs: under “Select your platform,” choose WordPress, Shopify, Wix or another platform and follow the integration, without editing the code on each page (on WordPress, this usually means one of the integration WordPress plugins);
  • manual install: under “Install manually,” copy the code block and paste it as high as possible inside the head tag, on every page of your site.

Then enter your site’s address and click Test. The older snippet had two parts (one in the head and one right after the opening body tag); according to Google, sites using that version don’t need to change it.

Step by step guide to installing Google Tag Manager, from creating the account and web container to adding the code to your site and running the final test.

3. Decide who can change the container

Google Tag Manager permissions are set per person. According to the Help Center article on permissions, each person can have No access, Read, Edit (edits but can’t publish), Approve (creates versions but can’t publish) or Publish (can do everything) on a container. Give Publish to just a few people, so nothing goes live without review.

How to use Google Tag Manager with GA4: the Google tag and events

Using Google Tag Manager with GA4 starts with the tag that loads Google Analytics on every page and continues with event tags for the actions that matter. You need a GA4 property with a web data stream and its measurement ID, which starts with G-.

According to the Help Center article on GA4 in Tag Manager, the recommended setup is:

  1. in your container, click Add Tag;
  2. under Tag Configuration, choose Google Analytics > Google Analytics;
  3. paste the Tag ID (G-XXXXXXXXXX);
  4. under Triggering, choose Initialization – All Initialization Events;
  5. save.

This tag already sends page views and enhanced measurement events, which are on by default in GA4: scrolling to 90% of the page, outbound clicks, site search, video engagement, file downloads and form interactions, according to the Analytics Help Center. Check this before you build a scroll tag in GTM.

To track a specific action, like a click on the “Buy now” button, create a Google Analytics: GA4 Event tag with your measurement ID and an event name (for example, click_buy), plus a click trigger with the condition “Click Text contains Buy now,” as shown in the Help Center article on events. For sales, use Google’s recommended event names (begin_checkout, purchase). Then, in GA4, mark the events that are your business KPIs as key events.

Summary of how to set up GA4 and events in Google Tag Manager, with the Google Analytics tag, the initialization trigger and click and purchase events.

Google Tag Manager Preview mode: how to test and publish

Google Tag Manager Preview mode is the testing environment where you browse your site with your changes active only in your browser, before publishing. According to the Help Center article on preview and debug, the steps are:

  1. on the Workspace tab, click Preview: Tag Assistant opens in a new tab;
  2. enter your site’s address and click Connect;
  3. browse and take the actions you want to track (click, submit a form);
  4. go back to Tag Assistant and check, for each event, which tags fired, which didn’t and what data was sent.

Your site’s visitors don’t see any of this. In GA4, the Realtime and DebugView reports confirm the data arrived.

If everything looks right, click Submit, choose Publish and Create Version, give the version a clear name and description (for example, “click_buy event on sales page”) and click Publish. Each version is saved under Versions, and you can roll back if something breaks.

Checklist for Google Tag Manager Preview mode, with Tag Assistant, checking which tags fired, publishing with the Submit button and describing every version.

Consent in Google Tag Manager: Consent Mode v2 and privacy laws

Consent in Google Tag Manager is the setup that makes your tags respect each visitor’s cookie choice, made in your site’s banner. Google’s tool for this is Consent Mode. According to the Consent Mode documentation, it uses four signals:

  • ad_storage: advertising cookies;
  • analytics_storage: analytics cookies;
  • ad_user_data: sending user data to Google for advertising;
  • ad_personalization: personalized advertising.

The last two came with Consent Mode v2. Google began stepping up enforcement of its EU user consent policy in March 2024, according to the Google Ads Help Center: if you advertise to or measure visitors in the European Economic Area, you need to send these signals to keep audience and personalization features.

In GTM, the simplest path is a consent management platform (CMP) template from the Community Template Gallery, fired by the Consent Initialization – All Pages trigger, which runs before any other tag, according to the Help Center article on consent in Tag Manager. In each tag, Consent Settings let you require additional consent before it fires. In the US, there’s no single federal privacy law, and some states have their own, such as the California Consumer Privacy Act (CCPA); if you have visitors in Europe, the GDPR applies.

Cards showing the four Consent Mode v2 signals in Google Tag Manager, from ad_storage to ad_personalization, with the consent banner firing before your tags.

Server-side tagging in Google Tag Manager: the short version

Server-side tagging means using a Google Tag Manager Server container, which runs on a server you control instead of in the visitor’s browser. According to Google’s introduction to server-side tagging, the server receives the data, turns it into events and decides what to forward to each tool.

The upside is more control over your data: only you can access what reaches the server until you choose to send it on. The trade-off is that you have to set up and maintain a server (on Google Cloud or elsewhere) and pay for hosting. For most small and midsize sites, the web container is enough.

How to use Google Tag Manager on a digital product’s sales page and checkout

Using Google Tag Manager on a digital product’s sales page lets you measure the journey: where the visitor came from, whether they clicked the buy button and whether they bought. The most common setup is:

  • tag your promotion links with UTMs: GA4 reads UTM parameters and shows which campaigns bring visits;
  • install GTM on your sales landing page: with the GA4 tag and a click event on the buy button;
  • install your ad platforms’ pixels: the Meta conversion pixel can go through GTM, which Meta lists among supported platforms in its developer documentation;
  • track the purchase at checkout: where it’s confirmed.

If your page is built with Hotmart Pages, you can install GTM under Marketing > Page creator > My pages: open the page, click the gear icon, go to Scripts, paste the container code, then save and publish, according to the Hotmart Help Center (updated April 2026).

On Hotmart’s checkout, the path is the Tracking Pixel, set up per product under Tools > Show all > Tracking Pixel. For GA4, just paste the G- ID and choose the events: page_view on the product page, begin_checkout on the payment page and purchase on a completed purchase, with product, value and currency, according to the Hotmart Help Center article on GA4. The same tool integrates Facebook, Google Ads, TikTok and other platforms. To avoid counting a sale twice, track the purchase in one place only (the Tracking Pixel) and keep the sales page events in GTM.

Once your data is in place, an attribution model helps you see which channel deserves credit and calculate your ROAS. If you’re not selling your knowledge online yet, signing up for Hotmart is free, and the fee is 9.9% + US$1.00 per approved sale, with the Player included.

Flow showing how to use Google Tag Manager on a digital product sales page, from links with UTMs to the click event and the purchase tracked at checkout.

Common Google Tag Manager mistakes

The most common Google Tag Manager mistakes come from rushing. The ones that skew your data the most are:

  • duplicate tags: GA4 installed with gtag.js in the code and also through GTM, or the purchase tracked in both GTM and the Tracking Pixel;
  • publishing without Preview mode: a trigger that’s too broad fires the tag on every page;
  • confusing names: tags like “Tag 1” and versions with no description make rolling back hard;
  • ignoring consent: tags that fire before the visitor makes a choice;
  • tracking everything: start with actions tied to sales and leads.

One simple habit prevents almost all of them: test in Tag Assistant and describe every version before publishing.

Ready to install Google Tag Manager on your site?

Google Tag Manager is the most practical way to manage your site’s tags: you install the container once and use it to set up GA4, events, pixels and consent, always testing before you publish.

Start small: create the account, install the container, set up the GA4 tag and one event on the most important button on your page. With that foundation, pixels, consent and server-side tagging get much easier. 🚀

Frequently asked questions about Google Tag Manager

Still have questions? Below, we answer some of the most frequently asked questions about Google Tag Manager.

Is Google Tag Manager free?

Yes. Google Tag Manager is free for websites and apps: all you need is a Google Account to create the account and containers. Google also offers Tag Manager 360, the enterprise version within Google Marketing Platform, for large companies.

Do I need to know how to code to use Google Tag Manager?

Not for the basics. Installing the container through your platform's integration and creating GA4, Google Ads and click event tags all use templates. The data layer, Custom HTML tags and server-side tagging call for JavaScript skills or a developer's help.

Does Google Tag Manager replace Google Analytics?

No. Google Tag Manager only installs and fires the tags; Google Analytics stores the data and shows the reports. They work together: GTM loads the GA4 tag, which sends visits and events to your property.

Where do I find my Google Tag Manager container ID?

The container ID starts with GTM- and appears on the Workspace tab, at the top of the Google Tag Manager dashboard. Platform integrations like WordPress and Shopify ask for it, since they only need the ID instead of the full code.

Discover Hotmart, the all-in-one platform for content creators, with an illustration of a hand holding a phone with a video
Discover Hotmart

Related posts

Illustration of Google Tag Manager: on a light background in isometric view, tags come out of an open container box, the orange one is the tag that fired, wired to pie, line and bar charts with gears alongside
12/04/2026 • Digital marketing
Google Tag Manager: what it is, what it’s for and how to install and set up GTM
A guide to Google Tag Manager: what GTM is, how tags, triggers, variables and the data layer work, how it differs from Google Analytics and gtag.js, how to install it step by step, set up GA4 and events, test and publish, Consent Mode v2, server-side tagging and how to use it on a digital product's sales page and checkout.
Illustration of means of communication: on a black background, a radio, newspaper, tube TV and laptop rise in an arc, with broadcast waves passing from one to the next until they reach an orange smartphone
12/04/2026 • Digital marketing
Means of communication: what they are, types, history and how to use each one to promote your business
A complete guide to means of communication: what they are, their functions, types and classification by language, history from old to modern with a timeline, the means Americans use most today according to Nielsen, Pew Research Center and DataReportal, how they differ from communication channels and how to use them to promote a digital product.
Illustration of how to promote a website: on an orange background, a browser window turns into a megaphone sending paper planes to a map pin, email, chat and a search magnifier
12/02/2026 • Digital marketing
How to promote a website: free and paid ways to get visitors and measure the results
How to promote a website step by step: getting your site on Google (Search Console, sitemap and indexing requests), ways to promote it (SEO, Google Business Profile, social media, email, partnerships, communities, Google Ads and Meta Ads), free vs. paid promotion, a 4-week plan to promote your website for free, how to measure with GA4 and UTMs and tips for course creators and affiliates.
Illustration of WordPress plugins: on a light background in isometric view, puzzle pieces with a shield, a speedometer and an orange cart snap into the website open on a laptop
12/02/2026 • Digital marketing
WordPress plugins: what they are, the best ones by category and how to choose them without slowing down your site
WordPress plugins: what they are, free vs. paid, the best ones by category checked in the official directory (SEO, security, backups, caching, forms, ecommerce, GDPR/CCPA and courses), how to install them, how to choose, how many to use and best practices for security and updates.
Table of Contents
Index
What is Google Tag Manager (GTM)? What Google Tag Manager is used for How Google Tag Manager works: account, container, tags, triggers and variables Google Tag Manager vs. Google Analytics vs. the Google tag (gtag.js) How to install Google Tag Manager: step by step How to use Google Tag Manager with GA4: the Google tag and events Google Tag Manager Preview mode: how to test and publish Consent in Google Tag Manager: Consent Mode v2 and privacy laws Server-side tagging in Google Tag Manager: the short version How to use Google Tag Manager on a digital product’s sales page and checkout Common Google Tag Manager mistakes Frequently asked questions about Google Tag Manager
Back to index.
Share this content
FacebookTwitterLinkedInWhatsapp
  1. Home
  2. Blog
  3. Google Tag Manager: what it is, what it’s for and how to install and set up GTM
  • Content creation
  • Affiliate marketing
  • Authorities Portal
  • How Does Hotmart Work?
  • Digital marketing
  • Signup for free
  • Português - Brasil
  • Español
  • Français
Made with
in Belo Horizonte, in Madrid, in Amsterdam, in Bogotá, in Mexico City, in New York
in Belo Horizonte
in Madrid
in Amsterdam
in Bogotá
in Mexico City
in New York
Terms and Policies

Hotmart — 2011-2026 © All rights reserved

Help Center
Hotmart Company