What Is Google Tag Manager and How Do You Use It? GA4, Google Ads and Consent Mode Setup

What is Google Tag Manager?
Google Tag Manager is a free tag management system that lets you add, test and publish measurement and marketing code on your website or app from one interface. You install two snippets once; after that you manage GA4, Google Ads, Meta and other tags without editing the site code.
Put simply, GTM sits between your developers and your marketing team and removes the waiting time between them. I have worked with ad and analytics accounts since 2012, and most tracking problems I see come from scattered, forgotten code. In this guide I explain tags, triggers and variables, GA4 and Google Ads setup, Preview mode and Consent Mode, based on official Google documentation.
What is Google Tag Manager used for?
The first benefit is speed. For example, when a new campaign needs a conversion tag, you do not wait for a developer sprint; you build the tag, test it in Preview and publish it. Also, because every tag lives in one list, you always know which tools run on your site.
The second benefit is control. GTM keeps every published state as a version, so you can roll back a bad change in a few clicks. The third benefit is consistency. You define a click or a form submission once and send that same signal to GA4, Google Ads and other platforms.
- Add, edit and remove tags without touching site code
- Measure clicks, forms, scroll depth and video engagement
- Test everything in Preview before it goes live
- Keep a full version history and roll back when needed
- Control tag behaviour based on visitor consent
In other words, GTM does not collect data by itself. Instead, it runs the tools that collect data, in an orderly way. That distinction matters, especially when people confuse GTM with GA4.
What are tags, triggers and variables?
Google's Tag Manager help page describes the system through three building blocks. Once you understand them, the rest of the interface makes sense.
- Tag: the code you want to run. For example, a GA4 event, a Google Ads conversion tag or a heatmap tool.
- Trigger: the condition that decides when a tag fires. A page view, a link click or a form submission.
- Variable: a value that triggers and tags use. The page URL, the clicked text or the order value.
In practice, you think in sentences: "When the thank you page loads (trigger), send the order value (variable) to the Google Ads conversion tag (tag)." Therefore I recommend writing these sentences down before you build anything. As a result, you end up with fewer tags, and every tag has a clear reason to exist.
What is the difference between built-in and user-defined variables?
GTM offers two kinds of variables. Built-in variables already exist; you simply switch them on in the Variables screen. Page URL, Page Path, Click URL and Click Text belong to this group. User-defined variables, on the other hand, are ones you create yourself.
These are the user-defined types I use most often:
- Data Layer Variable: reads values such as order value, transaction ID or form name.
- Constant: stores a value you reuse, such as your GA4 measurement ID.
- Lookup Table: returns one value based on another, for instance a form name based on the page path.
- Cookie and URL variables: read a query parameter or a first-party cookie.
A Constant looks minor, yet it saves real time. When an ID changes, you update one field instead of ten tags. Also, give variables consistent names; a prefix such as "DL - order_value" makes the list readable months later.
What do container, workspace and version mean?
A container holds all the tags, triggers and variables for one website or app. Every container has an ID that starts with GTM. Usually one container per website is enough; however, you create a separate container for a mobile app.
A workspace is the draft area where you prepare changes before publishing. If several people work in the same account, separate workspaces reduce conflicts. A version, finally, is a saved snapshot of each state you publish.
My habit is to give every version a descriptive name, such as "Added GA4 form submission event". That way, when you notice a drop in data six months later, you can see exactly which change went live and when. It is also a good moment to review user access and remove former agencies or staff.
Google Tag Manager or hard-coded tags: what is the difference?
Many businesses paste GA4 or ad code straight into their theme. For a single tag, that can look fine. However, maintenance gets harder with every tag you add. The table below sums up the difference.
| Topic | Hard-coded tags | With GTM |
|---|---|---|
| Adding a new tag | Needs a developer and a theme change | You add it in the interface |
| Testing | Often tested on the live site | You test in Preview mode |
| Rolling back | Depends on code history | You republish an older version |
| Interaction tracking | Custom code for each event | Built-in triggers |
| Consent handling | Separate logic in each snippet | Central consent settings |
| Visibility | Code spread across templates | All tags in one list |
That said, GTM does not solve everything. A developer still needs to add the code that fills the data layer, especially order details in e-commerce. So GTM reduces developer work, but it does not remove it.
There is also a question of responsibility. The freedom to add tags without code is powerful; still, the same freedom lets an untested Custom HTML tag break your site. Treat GTM like a publishing tool: test every change in Preview, write version notes and keep publish rights limited.
How do you set up a Google Tag Manager account?
Setup takes a few minutes. You sign in to tagmanager.google.com with your Google account and follow the steps in order.
- Choose "Create Account", then enter the account name (your company) and country.
- Use your domain as the container name and select Web as the target platform.
- Accept the terms of service; GTM then shows you two snippets.
- Place the first snippet as high as possible in the head of every page.
- Place the second snippet immediately after the opening body tag.
- Confirm with Preview mode that the container loads on all pages.
If you use WordPress, Shopify or a similar platform, you often get a dedicated field or plugin instead of a theme edit. Not sure what your site runs on? Check it first with the website technology checker. Also, if an old GA snippet or a second container remains on the page, your data may double; clean that up before you start.
Should you use the Google tag (gtag.js) or GTM?
The Google tag connects Google products such as GA4 and Google Ads through one snippet. GTM, in contrast, manages Google products plus tags from other platforms. They are not competitors; inside GTM you also use the "Google Tag" tag type.
So which one fits you? For a small brochure site that only uses GA4 and needs no interaction tracking, the Google tag alone can be enough. However, once you run several ad platforms, measure forms and clicks, or handle consent, GTM gives you a much calmer workspace.
In my experience, businesses grow and their tracking needs grow with them. For that reason, starting a new site with GTM saves a painful migration later. On an existing site, switch in one go; adding GTM before you remove the old code means double counting.
Plan the switch date as well. Pick a quiet week rather than a peak campaign period, then compare numbers daily for the first three days. That way you catch any issue before it affects your budget.
Why does the data layer matter so much?
The data layer is the shared language between your site and GTM. The page drops information into this layer when something happens, and GTM reads it from there. For instance, when an order completes, the order ID, value and currency land in the data layer.
Why does that matter? Because scraping visible text from the page is fragile. When the design changes, a button label or class name changes too, and your tag silently stops working. The data layer, by contrast, stays independent of design, so your tracking lasts longer.
My advice is simple: on any e-commerce or lead generation site, ask your developer for data layer events, at least for conversions. Also, align event names with GA4's recommended events, such as purchase and generate_lead. Consequently, both GA4 reports and Google Ads imports work without extra mapping.
How do you set up GA4 with Google Tag Manager?
I covered what GA4 is and how it differs from the old version in my GA4 guide; here I focus on the GTM side only. First, copy the measurement ID that starts with G- from the data stream in your GA4 property.
- In GTM, open Tags, create a new tag and choose "Google Tag" as the tag type.
- Paste the G- ID into the Tag ID field.
- Choose "Initialization - All Pages" or All Pages as the trigger.
- Give the tag a clear name and save it.
- Open Preview mode and confirm that the tag fires.
- Check your session in GA4 DebugView, then publish.
This step only turns on basic page views and GA4's enhanced measurement. For events that reflect business goals, you need separate tags. To decide which actions truly count as goals, read my guide on how to set website conversion goals.
Which triggers should you use for GA4 events?
A GA4 event tag ("Google Analytics: GA4 Event") always needs a trigger. The built-in triggers cover most needs; still, each one has strengths and blind spots.
- Custom Event: catches an event pushed to the data layer. This is the most reliable option for purchases and form submissions.
- Click - Just Links: ideal for phone, WhatsApp and email links.
- Form Submission: works with standard forms but often fails with AJAX forms.
- Scroll Depth: shows reader interest on content pages.
- YouTube Video: captures starts and progress on embedded videos.
- Element Visibility: fires when a thank you message appears on screen.
In practice, most mistakes happen in form tracking. For example, GTM counts a submission even when the visitor makes an error, and your conversion numbers inflate. Therefore I suggest you measure form success through a thank you page, the visibility of a success message or a data layer event.
Which e-commerce events should you track with GTM?
E-commerce is where GTM adds the most value. GA4's recommended e-commerce events follow the customer step by step. The data for each step comes from the data layer, and GTM then distributes it to GA4 and your ad platforms.
- view_item_list: a category or search results page shows a product list
- view_item: a visitor opens a product detail page
- add_to_cart: a visitor adds a product to the cart
- begin_checkout: the visitor starts checkout
- add_payment_info: the visitor enters payment details
- purchase: the order completes
These six events show where your funnel leaks. For instance, if add to cart is high but begin checkout is low, the cause is often shipping cost or forced account creation. However, you cannot draw that conclusion from wrong data, so always compare purchase value and transaction ID with your back end records.
If your platform has a native integration, look at that first. Many shop systems fill the data layer for you, and you only build the tags in GTM. As a result, you need far less developer time.
How do you track Google Ads conversions with Google Tag Manager?
On the Google Ads side, you first create the conversion action. When you pick Tag Manager as the setup method, Google shows you a Conversion ID and a Conversion Label. You will use both values in GTM.
- In GTM, create a new tag and choose "Google Ads Conversion Tracking".
- Paste the Conversion ID and Conversion Label into their fields.
- If you track sales, fill conversion value, transaction ID and currency with data layer variables.
- Choose your purchase or form success event as the trigger.
- Make sure the same container has a "Conversion Linker" tag.
- Test in Preview, publish, and watch the conversion status in Google Ads for a few days.
Do not leave the transaction ID empty; it prevents Google Ads from counting the same order twice. Also, if you want better matching with first-party data, you can enable the settings from my enhanced conversions setup guide through GTM. If you would rather have account structure and bidding handled together, my team and I cover this setup end to end as part of Google Ads management.
What does the Conversion Linker tag do?
The Conversion Linker is a GTM tag that stores ad click information in a first-party cookie. When someone clicks an ad, a parameter such as gclid appears in the URL. The linker saves it; then, when the visitor converts a few pages later, Google Ads matches the conversion to the right click.
What happens without it? You either see no conversions or you see fewer than you should. The gap grows in browsers that limit third-party cookies, such as Safari. So I recommend running this tag on all pages in every container that supports Google Ads.
One more note: if checkout sends visitors to another domain and back, check the linker's cross-domain setting. Otherwise, conversions after payment can disappear. To keep your campaign links tidy, the UTM builder helps too.
How do you test tags in Preview mode?
The Preview button at the top right of GTM opens Tag Assistant. You enter your site URL, and the site opens in a new tab in debug mode. In the Tag Assistant tab, you then see every event on the page in order.
Under each event you see which tags fired, which did not, and the current value of every variable. For example, after you submit a form, you select that event and check whether the conversion tag appears under "Tags Fired".
- If a tag did not fire, compare the trigger condition with the variable value.
- If a tag fired twice, look for a second trigger that listens to the same event.
- When a value arrives empty, check the name of the data layer variable.
Preview only runs in your own browser, so visitors notice nothing. When testing ends, click Submit, write a version description and publish. In short, skipping Preview means experimenting on your live site.
What is Consent Mode and how does it work in GTM?
Consent Mode adjusts how Google tags behave based on a visitor's cookie choice. Google's developer documentation defines four core consent types:
- ad_storage: storage of advertising cookies
- analytics_storage: storage of analytics cookies
- ad_user_data: sending user data to Google for advertising
- ad_personalization: personalised advertising
In GTM, you first set a default state, then update it when the visitor makes a choice. The default must run before every other tag, using the "Consent Initialization - All Pages" trigger. Google recommends the setDefaultConsentState and updateConsentState APIs used by templates rather than gtag commands inside GTM, because gtag commands can end up late in the queue.
Most consent management platforms (CMPs) offer a template in the Community Template Gallery. As a result, you can set up both steps without writing code. If you show Google ads to users in the European Economic Area, Google's EU user consent policy makes this setup mandatory.
Basic or advanced Consent Mode: which should you choose?
In basic mode, Google tags do not load at all until the visitor consents. A visitor who declines sends no signal, and Google fills the gap with a general model. In advanced mode, tags load from the start; however, without consent they send cookieless pings that carry no identifiers.
Which one is right for you? This is a legal decision first, so I recommend leaving the final word to your legal adviser. From a technical view, advanced mode supports richer modelling. On the other hand, basic mode offers a simpler data flow, and some businesses find it easier to justify.
Under GDPR, your cookie banner and privacy notice are part of this setup as well. I cover the legal side in my article on how to build a GDPR compliant website. In GTM itself, you can enable the consent overview in the container settings under Admin and see which consent each tag depends on in one screen.
Should you move Meta Pixel and other platform tags into GTM?
Usually, yes. Keeping Meta, TikTok, LinkedIn and similar tags in one container means you manage consent and trigger logic in one place. For example, the same form success trigger can feed GA4, Google Ads and Meta at once.
I explain Meta Pixel setup and its relationship with the Conversions API in my Meta Pixel guide, so I will not repeat it here. From a GTM point of view, one thing matters: install platform tags through official or well maintained templates from the Community Template Gallery. Keep Custom HTML tags as a last resort.
Also, make sure every platform receives the same event from one definition. Otherwise GA4 shows one number, the ad platform shows another, and you cannot tell which to trust.
What are the most common Google Tag Manager mistakes?
I see the same mistakes again and again in the accounts I audit. Most of them come from rushed setups, not bad intent.
- GA4 code in both the theme and GTM, which causes double counting
- Measuring form submissions through button clicks instead of real success
- A missing Conversion Linker tag
- An empty transaction ID field on the purchase tag
- A Consent Mode default that runs after other tags
- Versions without descriptions, so nobody knows who changed what
- Former agency or staff accounts that still have access
I suggest you review this list at least twice a year. In addition, run a quick Preview test after every redesign or theme change. When the design changes, click and form triggers often stop working without any warning.
Does Google Tag Manager slow down your website?
GTM itself loads as a light script; the real weight comes from the tags you put inside it. In other words, if you add fifteen marketing tools, the page still downloads and runs all of them. GTM does not create that problem, but it can hide it.
So ask one question for every tag: do we still use this? Remove trial tools, old chat widgets and tags from finished campaigns. For Custom HTML tags, fire heavy libraries only on the pages that need them instead of on every page.
Building a clean tracking layer from day one is part of a good web design project. In the web design projects my team and I deliver, we prepare the tracking plan alongside the design, so correct data flows from launch day.
Who needs server-side tagging?
With server-side tagging, the browser no longer sends data straight to every platform. Instead, it sends data to a server container you control, and that container forwards it to the right tools. As a result, you get tighter control over which data reaches which platform.
However, this setup brings extra cost and technical upkeep. Hosting fees, domain configuration and monitoring become your responsibility. For a small business website, it is often unnecessary.
In my experience, server-side tagging makes sense for e-commerce sites with large ad budgets, brands that send data to many platforms, and sectors with strict data sharing rules. Clean up your web container first; if the foundation is weak, a server container simply carries the errors further.
How should you manage user permissions in GTM?
Google Tag Manager handles permissions at account level and container level separately. At account level, a person is either a User or an Administrator. At container level, the options are Read, Edit, Approve and Publish.
My recommended setup is simple. Give agencies and contractors Edit access; keep Publish rights with one or two people on your own team. That way no change reaches the live site without your knowledge.
Moreover, ownership should always stay with the business's own Google account. A container that an agency creates in its own account can turn into a painful migration when the relationship ends. Once a year, open the user list and remove anyone who no longer works with you. This small habit makes a real difference for both security and data consistency.
Should you set up GTM yourself or get help?
On a small business site, installing GA4 and one form conversion is something you can handle yourself with the steps above. If you use Preview and test every change, the risk stays low.
However, I recommend getting help in these cases: e-commerce purchase data, several ad platforms, Consent Mode with European traffic, or checkout across domains. Here a small mistake can lead to months of wrong bidding decisions.
A large part of what my team and I do is fixing measurement before we touch campaigns. The same data also drives content decisions on the organic side, which is why we check the Google Tag Manager setup in the first week of every SEO consulting project.
What should you check after a Google Tag Manager setup?
The first week after publishing is your validation period. You can use this short checklist.
- Find your own visit and a test conversion in the GA4 realtime report.
- Confirm the conversion action status in Google Ads.
- After one day, compare GA4 with your back end order or lead count.
- Decline cookies on your banner and inspect consent state in Preview.
- Repeat the same test on a mobile device.
Small gaps between numbers are normal; however, a gap of twenty percent or more points to a setup issue. Once conversion counts settle, you can compare page and campaign performance with the conversion rate calculator. In short, a good GTM setup is not a one-time job; you keep the container current as your site and campaigns change.




