Google Tag Manager is the tool that separates businesses with control over their own data from those waiting weeks for developers to add a tracking code. A proper setup gives you the freedom to launch new tags, track events, and measure conversions without touching the source code. But GTM is only as good as its implementation. This guide walks you through everything from basic setup to server-side tracking and governance frameworks.
What Google Tag Manager is and why you need it
Google Tag Manager (GTM) is a free tag management system from Google that lets you manage and deploy tracking tags on your website through a web interface — without modifying the source code directly. In practice, this means you can add, modify, and remove tracking codes for Google Analytics, Google Ads, Meta Pixel, LinkedIn Insight Tag, and hundreds of other tools without involving a developer for each change.
According to BuiltWith, over 30 million websites use Google Tag Manager globally, making it the most widely used tag management system in the world (BuiltWith, "Tag Manager Technology Usage," 2025). For businesses operating in competitive markets, GTM is particularly relevant because it gives the marketing team direct control over tracking, which is critical when speed in campaign launches and data-driven decision support are competitive advantages.
Without GTM, most businesses end up in a situation where every new tracking tool requires a developer ticket, a deployment process, and typically several days of waiting. With GTM, this is reduced to minutes. This means faster campaign launches, faster error correction, and better data quality because changes can be made and tested immediately.
GTM account structure: Account, container, workspace, and versions
GTM is organized in a hierarchy: at the top you have an account, which typically corresponds to the business or organization. Under the account you have containers, which correspond to individual websites, apps, or server-side environments. Each container has workspaces where you make changes, and published versions that represent the history of all published configurations.
For most businesses, we recommend one GTM account per organization and one container per website. If you have separate domains for different products or services, each should have its own container. The free version of GTM gives you three simultaneous workspaces, which is usually sufficient for teams of up to five people. GTM 360 (the paid version) provides unlimited workspaces and approval workflows.
Version control in GTM is one of the most underrated features. Every time you publish, a version is created with a timestamp, user information, and notes. If something goes wrong, you can roll back to a previous version with one click. Always use version descriptions that explain what was changed and why — this is invaluable when you are troubleshooting problems three months later.
Installing GTM: Code placement and verification
GTM is installed with two code snippets: one script element in the head section and one noscript element right after the body tag. The head script loads the GTM container and should be placed as high in the head as possible — ideally before other scripts — to ensure tags fire early enough. The noscript element is a fallback for browsers without JavaScript enabled.
To verify that GTM is correctly installed, use Google Tag Assistant (tagassistant.google.com). Enter your website URL, and Tag Assistant will confirm that the container code is found, that it fires correctly, and that there are no conflicts. Additionally, you can check the browser developer tools: in the Network tab, you should see a request to gtm.js with your container ID.
A common problem during installation is that the GTM code is placed too far down in the head, or that it is blocked by other scripts. Verify that the GTM script does not have async or defer attributes added manually — GTM handles asynchronous loading itself. For websites built with frameworks like Next.js or Nuxt, dedicated packages exist (for example @next/third-parties for Next.js) that handle GTM integration correctly.
Understanding tags, triggers, and variables
GTM is built on three fundamental concepts: tags are the code to be executed (for example a GA4 tracking call or a Meta Pixel event), triggers define when the tag should fire (for example on page load, click, or form submission), and variables are dynamic values that tags and triggers can use (for example the page title, a URL parameter, or a value from the data layer).
Think of it as an if-then logic: If the user clicks a button with the class buy-button (trigger), send a purchase event (tag) with the product name and price as parameters (variables). This structure provides enormous flexibility because you can combine different triggers and variables with the same tag, or use the same trigger for multiple tags.
A good practice is to keep tags focused on one task. Avoid filling custom HTML tags with complex logic that does multiple things. Instead, split into separate tags with clear names that describe what they do. For a thorough introduction to tracking setup, see our GA4 setup guide, which covers how GA4 tags are configured in GTM.
Essential tags to configure
The first tag you should set up is Google Analytics 4 (GA4). Use the built-in GA4 Configuration Tag with your Measurement ID (G-XXXXXXX). Configure it to fire on the All Pages trigger. Then set up individual GA4 event tags for conversions and custom events relevant to your business.
Google Ads conversion tracking is the next priority if you run paid search. Use the Google Ads Conversion Tracking tag with the conversion ID and label from your Google Ads account. For remarketing, add the Google Ads Remarketing tag. Meta Pixel (Facebook) and LinkedIn Insight Tag are also critical for most businesses using social media for advertising — both have dedicated tag templates in GTM.
For a complete walkthrough of conversion tracking, see our conversion tracking guide. Custom HTML tags are used for tools without a dedicated GTM template — for example chatbots, heatmap tools like Hotjar, or custom scripts. Use these with caution and always test thoroughly, as errors in custom HTML can affect the entire website.
- GA4 Configuration Tag: Basic pageview tracking with Measurement ID
- GA4 Event Tags: Conversions, form submissions, clicks on key elements
- Google Ads Conversion Tracking: Conversion tracking with value and currency
- Meta Pixel: Pageview, standard events (Lead, Purchase, AddToCart)
- LinkedIn Insight Tag: Pageview and conversion tracking for B2B campaigns
- Custom HTML: Hotjar, Clarity, chatbots, and other third-party tools
Built-in variables vs. user-defined variables
GTM comes with a set of built-in variables that cover the most common needs: Page URL, Page Hostname, Page Path, Referrer, Click Element, Click Classes, Click ID, Click URL, Form Element, and more. These must be enabled in the GTM interface under Variables > Built-In Variables > Configure.
User-defined variables are where the real flexibility shows. The most important types are: Data Layer Variable (retrieves values from the dataLayer object, for example product name or transaction values), DOM Element (retrieves values from HTML elements on the page), JavaScript Variable (reads global JavaScript variables), URL Variable (parses URL parameters, for example UTM tags), and Constant (stores fixed values like Measurement IDs).
For data-driven businesses, Data Layer Variables are the most important. They let you separate what the website knows (business data like product name, price, and category) from what GTM can observe (clicks, pageviews, URLs). By using a well-designed data layer, you avoid scraping data from HTML elements — which is fragile and easily breaks with design changes. For more on terminology, see our glossary for definitions of data layer, event tracking, and conversion tracking.
Trigger types and when to use them
GTM offers a range of trigger types that cover different user interactions. Page View triggers are the most basic and include Page View (DOM Ready is not necessary for most tags), DOM Ready (useful when the tag needs access to HTML elements), and Window Loaded (for tags that should wait until all content is loaded). For most tracking tags, standard Page View is sufficient.
Click triggers (Click - All Elements and Click - Just Links) let you track button clicks, link clicks, and other interactions. Use Click - Just Links for outbound links and downloads, and Click - All Elements for buttons and other interactive elements. The Form Submission trigger captures form submissions, but sometimes requires Check Validation to be enabled to avoid firing on invalid submissions.
Scroll Depth triggers let you track how far down users scroll — useful for content websites. Timer triggers can be used to measure time on page or delay tags. Custom Event triggers are the most flexible: they fire based on custom events pushed to the dataLayer via JavaScript. These are essential for tracking complex interactions like video playback, accordion opens, or steps in a multi-step process.
- Page View: Page load (standard for most tags)
- DOM Ready: When the HTML structure is available
- Window Loaded: After all resources are loaded
- Click: Button clicks, link clicks, interactions
- Form Submission: Form submissions with validation
- Scroll Depth: Percentage or pixel-based scroll
- Timer: Time-based events
- Custom Event: Custom dataLayer events
Data layer implementation: Events and e-commerce data
The data layer (dataLayer) is a JavaScript object that acts as a bridge between your website and GTM. By pushing structured data to the dataLayer, you can make business information available to tags without GTM needing to read it from the HTML. This is best practice because it provides reliable, consistent data that does not break with design changes.
A dataLayer.push() looks like this: dataLayer.push({ event: "purchase", transaction_id: "T12345", value: 1499, currency: "NOK", items: [...] }). The event key is special — it triggers a Custom Event trigger in GTM. The remaining keys are data that can be read with Data Layer Variables and forwarded to GA4, Google Ads, or other platforms.
For e-commerce, there is an established standardized data layer structure from Google that includes events like view_item, add_to_cart, begin_checkout, and purchase. Implement this standard from the start — it saves enormous time because GA4, Google Ads, and other Google products understand these events automatically. Always document your data layer specification in a shared document that both developers and marketers have access to.
GTM for server-side tracking
Server-side GTM is a separate container that runs on a server you control, instead of in the user's browser. The flow is: the user's browser sends data to your server (via a GTM Web Container), the server processes the data, and forwards it to the platforms (GA4, Google Ads, Meta, etc.). This provides significantly better data quality because you bypass ad blockers and browser restrictions.
For setup, you need a Google Cloud Platform account (or a third-party service like Stape.io or Addingwell) that runs the Server Container code. The simplest approach is to use Stape.io, which offers a managed service from around 20 euros per month. Google Cloud requires more technical expertise but gives you full control.
Server-side tracking is especially relevant for businesses operating under GDPR, because you can control exactly what data is forwarded to third parties. For a deeper walkthrough of server-side tracking, see our dedicated server-side tracking guide. At LeapJet, we implement server-side GTM for clients who want maximum data quality and full GDPR control over data flows.
Debugging: Preview mode and Tag Assistant
GTM's Preview mode is the most important tool for debugging tag configuration. When you activate Preview (via the button in the top right of GTM), Tag Assistant opens in a new tab showing exactly which tags fire, which triggers activate, and what values the variables have — all in real time as you navigate the website.
In Tag Assistant, you can click on individual events in the timeline (for example Page View, Click, Custom Event) and see which tags fired on that specific event, which did not fire and why, and what data was sent. The Variables tab shows all variable values at the time of the event, which is invaluable for finding errors in the data configuration.
For more advanced debugging, use the browser developer tools. In the Console tab, you can type dataLayer to see the entire dataLayer contents. In the Network tab, you can filter on collect to see GA4 requests, or facebook for Meta Pixel calls. Verify that the correct parameters are sent with the correct values. Always do a full round of debugging before publishing new tags — it takes ten minutes and saves you days of polluted data.
Governance: Naming conventions, folder structure, and access control
A GTM setup that works for one person collapses when the team grows to three or five. Governance is about establishing rules that make the container maintainable over time. Start with naming conventions: use a consistent format like [Platform] - [Type] - [Description], for example GA4 - Event - Purchase or Meta - Pageview - All Pages. This makes it easy to search, filter, and understand what each tag does.
Organize tags, triggers, and variables in folders based on platform or function. Examples: GA4, Google Ads, Meta, LinkedIn, Utilities. Folders provide visual order and make it easier for new team members to orient themselves. Remove unused tags, triggers, and variables regularly — a container full of outdated elements is a security risk and a source of confusion.
Use GTM's built-in access control to restrict who can publish changes. Give most team members Edit access and restrict Publish access to one or two people who review changes before publishing. Document all changes in the version description. For teams working with multiple clients or projects, we recommend a central document describing all active tags, their purpose, and who owns them. For more about our services, see our SEO and analytics services.
- Naming convention: [Platform] - [Type] - [Description]
- Folder structure: Organize by platform or function
- Version descriptions: Document what and why with each publish
- Access control: Restrict Publish access to senior members
- Regular cleanup: Remove unused tags, triggers, and variables quarterly
- Tag documentation: Central document with all active tags and ownership

