22/2/2026
How to Install Google Tag Manager on a Website: A Reliable, Repeatable Method
If you have already read our guide to Google Tag Manager, you will be familiar with the role of containers, tags and triggers. This article focuses purely on the technical execution: a practical, step-by-step approach to installing Google Tag Manager correctly, avoiding duplicates, and validating everything reliably from the very first release.
The Goal: Install, Test and Protect Data Collection From Day One
The aim is not simply to paste in a piece of code. A solid implementation should enable you to:
- load the GTM container on 100% of relevant pages (at minimum, all public-facing pages);
- protect performance (GTM loads
gtm.jsasynchronously, but poor script stacking can still harm user experience); - avoid double-counting (for example, analytics hard-coded in the theme and then added again via GTM);
- make the setup testable using Preview mode and debugging tools.
In a context where a significant share of searches result in no click at all (figures referenced by Semrush in 2025 and summarised in our SEO statistics, as well as our GEO statistics and SEA statistics), every session you do earn becomes more valuable. Clean tracking therefore supports both marketing steering and SEO performance equally.
Before You Start: Access, CMS Constraints, Caching, CDN and Publishing Rights
Before making any changes, make sure you have the following in place:
- Access to the code (FTP, repository, theme access or CMS interface) and the ability to edit the
<head>section and the opening<body>tag. - GTM publishing rights (at least the ability to publish, or a process where an authorised person publishes on your behalf).
- An environment plan: if you have a staging environment, decide whether to install there first (often recommended) before pushing to production.
- A cache and CDN plan: you may need to purge or refresh CMS cache, server cache and CDN; otherwise you risk testing an outdated version of the page.
- A duplicate-tag check: identify any scripts already injected by the theme, modules or native integrations. A thorough technical SEO audit typically includes this step, because duplicated tags distort your data and, ultimately, your decisions.
Create Your Account and Container: Retrieve the Container ID for Deployment
To get started, sign in to GTM at tagmanager.google.com, then create an account and a container. The fields are fairly consistent across setups, but disciplined naming will prevent you from deploying the right code in the wrong place.
Set Up a "Web" Container: Naming Conventions and Tag Governance
When creating the container:
- Enter the account name (typically your organisation name).
- Select the primary country.
- Create a container for the Web platform (website or blog).
A simple, robust convention is to name the container using the domain and environment — for example, example.com - prod and example.com - staging if you separate your environments. This reduces publishing mistakes and makes later checks considerably easier.
Where to Find the GTM-XXXXXXX Identifier: What It Does and What to Check
The container ID (in the format GTM-XXXXXXX) is the key that loads the correct container on your site. You can find it in two convenient places:
- In the workspace: the ID is displayed in the GTM interface, typically near the top of the screen.
- In the installation snippets: it appears within the script URL (
.../gtm.js?id=GTM-XXXXXXX).
A critical check: always confirm you are installing the correct environment ID (production versus staging). Using the wrong ID is a classic pitfall — everything appears to be in place, but you end up debugging a completely different container.
Understanding the Two Snippets: GTM Script and GTM Noscript
GTM provides two complementary snippets with different roles and very specific placement requirements. For a deeper explanation of each one, see our dedicated articles on the script and the noscript.
Head and Body Placement: Where the Code Goes in <head> and <body>
The practical rule is straightforward:
- Snippet 1: place it in the
<head>, as high as possible. - Snippet 2: place it immediately after the opening
<body>tag.
The logic is clear: the first snippet loads the container as early as possible; the second provides limited coverage in cases where JavaScript does not run, or runs poorly.
The GTM Script in the <head>: Exact Placement and Common Mistakes
Within the <head>, place the GTM snippet ideally just after your <meta> and <link> tags, and before any other scripts. Many implementation guides recommend this order so GTM is among the first scripts to execute, reducing the risk of missing events that fire early in the page load.
What the script typically does:
- initialises
window.dataLayerif it does not already exist; - pushes a start event (
gtm.start); - loads
gtm.jsasynchronously with the container ID and, where relevant, a custom data layer name.
Common mistakes to avoid:
- placing the script too low (after other scripts or at the end of the page), which increases the risk of missing navigation signals;
- editing the snippet without a very specific, well-justified reason;
- installing two containers on the same pages without a clear multi-entity strategy;
- leaving an old hard-coded tag (such as an analytics snippet) in place while also redeploying it through GTM, creating double tagging.
The GTM Noscript in the <body>: Why It Matters and Edge Cases
The <noscript> block is a fallback mechanism. It must be placed immediately after the opening <body> tag. Its purpose is to allow a minimal level of loading even when the browser cannot execute JavaScript.
Key points to bear in mind:
- Do not place it at the bottom of the page: it loses much of its value if positioned there.
- Ensure it appears on every page template, particularly if your site uses multiple layouts.
- On some tightly constrained platforms — especially within checkout flows — the exact placement may be imposed or restricted by the platform itself.
CMS-Specific Installation: WordPress, PrestaShop and More Advanced Setups
The reference approach remains inserting both snippets directly into the source code. That said, depending on your CMS, file paths, modules and caching constraints will vary.
WordPress: Add the Code Without Duplicating Tags or Breaking the Theme
Two common approaches are available:
- Manual insertion: via FTP or the theme editor, locate the file containing the
<head>section and the opening<body>tag (oftenheader.php). Add the first snippet inside<head>, then the second immediately after<body>. - Using a plugin: some plugins allow you to paste the
GTM-XXXXXXXID into a field. This can speed up deployment, but requires extra vigilance around duplicates — a theme may already inject a tag, or another plugin may handle a similar measurement.
A reliability tip: if you use a plugin, document precisely where GTM is injected and disable any competing injection. One implementation source per tag remains the safest rule to follow.
PrestaShop: Clean Implementation, Templates and Surviving Updates
On PrestaShop, a module-free implementation typically involves editing theme templates directly. A commonly referenced file path is:
themes/your_theme/templates/_partials/head.tpl
You then integrate the container code according to your theme structure. If your configuration uses Smarty, some guides recommend wrapping the code in {literal} tags to prevent unwanted interpretation by the templating engine.
A performance-critical point: during the change, PrestaShop may require a temporary adjustment to template recompilation settings. The recommended approach is to enable recompilation while making the change, then return to optimal settings after validation, to avoid degrading performance in production.
An alternative is to use a module that accepts the container ID and activates GTM automatically. As with WordPress, the trade-off is duplicate management — another module or native integration may already be inserting tags.
Advanced Cases: SPAs, Multi-Domain, Subdomains, Staging and Environment Management
In the following scenarios, the principle of installing both snippets across all pages still holds, but validation becomes considerably more complex:
- SPAs (Single Page Applications): URL changes do not always trigger a full page reload. You must ensure your tracking relies on appropriate events — and often a more structured dataLayer strategy.
- Multi-domain and subdomains: align your installation strategy (one container or several) and document what is managed in GTM versus in the codebase to avoid inconsistencies.
- Staging environments: ideally, test on staging first, then publish to production. Ensure the installed container corresponds to the correct environment and that triggers do not contaminate production data.
Installation Verification: Confirm Loading and Debug Properly
An installation is only considered complete once you have validated (1) that the container loads correctly, and (2) that expected tags fire across a realistic user journey.
Preview Mode: Read the Debugger, Validate Loading and Check Tag Firing
From the GTM workspace, click Preview. The standard flow is as follows:
- Tag Assistant opens.
- Enter the full URL of the page you wish to test, then connect.
- Your website opens in a new tab.
- Check the connection status (displayed as "Connected" or similar, depending on the interface).
In the debugger, you should confirm that:
- the container is detected on the page you visited;
- events occur as expected (page load, clicks, form submissions, and so on);
- expected tags fire on the correct event, and only once.
If Preview mode does not connect, common causes include browser cache, ad blockers or a missing snippet on the page. Test in a private browsing window, temporarily disable blocking extensions, purge caches, then validate again.
For a complete validation process, follow our guide to testing GTM in a structured way — both before publishing and after going live.
Tag Assistant: What It Actually Checks for Google Tags and Containers
Tag Assistant primarily helps you confirm two things: (1) that the container loads, and (2) that tags do or do not fire based on events. It does not replace business-level validation: you still need to confirm that the right parameters are being collected, that conversions fire at the correct moment, and that you are not creating duplicate sends.
A good habit: after validating with Tag Assistant, also check consistency within your measurement tools. If you are unsure where analytics ends and tag management begins, our article on Google Tag Manager vs Google Analytics clarifies the distinction between "trigger and send" and "measure and report".
Tag Assistant Legacy: Limitations and Potential False Positives
The historical Chrome extension "Tag Assistant Legacy" can still be useful for a quick check that tags are present on a page, but its signals — colours, alerts — can generate false positives or mask trigger issues. Treat it as a clue, not a final validation.
If it flags a problem, return to GTM Preview mode: that is where you can see the full firing sequence event by event and fix any issue at the right level — trigger, conditions, variables or published version.
Final Checklist: Single Tags, Full Coverage, Clean Publishing and No Duplicates
- Both snippets are present (head and body) across all relevant page templates.
- The correct container ID is installed (production is distinct from staging).
- The container loads on key pages (homepage, SEO landing pages, forms and transactional pages).
- Preview mode connects and displays events as expected.
- No critical tag is duplicated (analytics, conversions, and so on).
- Changes have been published with a clear cycle (named version, description and date).
Data Quality: dataLayer Push, Consent and Measurement Reliability
Technical installation is the foundation. To obtain stable, refactor-resistant data over time, reliability depends on two further pillars: a well-structured data layer and consistent consent management.
Build a Robust Data Layer: Principles and a dataLayer Push Example
A dataLayer lets you push business information as structured objects, enabling you to fire tags from a stable signal rather than fragile DOM elements such as text content, structural classes or elements that change between releases.
Example of a dataLayer push on the site side:
dataLayer.push({ event: "demo_request", form_name: "demo", plan: "pro"});
Then, in GTM, you can:
- create a Custom Event trigger listening for
demo_request; - create Data Layer Variables for
form_nameandplan; - fire an analytics event tag and, if needed, an advertising conversion tag — both from the same robust signal.
This approach is particularly useful in B2B contexts for distinguishing a click on a CTA from an actual form submission, and for avoiding the mistake of counting an expression of intent as a confirmed conversion.
Consent and Cookies: Impacts on Collection, Testing and Compliance
Consent settings can prevent certain tags from firing, which may create discrepancies between tools. The priority is to keep behaviour explainable and documented: which tags fire before consent is given, which fire after, and which never fire without explicit agreement.
Two direct implications for your testing process:
- test under both "consent accepted" and "consent refused" conditions, as the results will differ;
- document your consent rules and their expected impact on reporting figures.
To go further on this topic and avoid common configuration mistakes, see our article on cookies in GTM.
Connecting the Dots: Analytics and Search Console Integration
Once GTM is installed, the real value comes from linking visibility data (from search engines) with behavioural data (from your site). The most common misconception is expecting GTM to generate reports — its role is to orchestrate tag firing, not to produce analytics.
Clarify the Roles of Google Analytics and Tag Management to Avoid Confusion
A tag manager triggers and sends data. An analytics tool such as GA4 receives that data and turns it into reports. The two are complementary, not interchangeable. If you implement GA4 via GTM, maintain a single active implementation to avoid duplicate page views and events.
For practical guidance on the tag manager and analytics setup, our resource on Google Tag Manager and Google Analytics walks through the main points to watch out for.
After Installation: Governance, Versioning and Tag QA Best Practices
Once GTM is in place, long-term stability comes from disciplined process:
- version every publish with a clear name, description and context;
- always test in Preview mode before publishing to production;
- limit publish permissions to accountable roles;
- disable or remove unused tags to protect page performance and reduce tracking debt.
A performance reminder: Google has consistently highlighted that users are more likely to abandon a site when loading times are too slow (figures summarised across our statistics content). Keeping your container lean and well-governed is therefore a UX decision as much as an analytics one.
Validate SEO Tracking: Search Console Integration and Signal Consistency
To steer your SEO effectively, you need two families of signals: (1) visibility data from Google (impressions, clicks, queries and positions), and (2) on-site data (engagement and conversions). Google Search Console and Google Tag Manager play different roles, but together they allow you to analyse the full journey from search query to conversion.
A note on Incremys, without any changes to your existing stack: the platform integrates both Google Search Console and Google Analytics via API, making it easier to connect visibility data, entry pages and outcomes — with built-in consistency checks to surface tracking anomalies or journey breakpoints.
GEO Angle: Visibility in Generative AI Answers and Why Clean Tracking Still Matters
Visibility surfaces are evolving rapidly — AI Overviews, generative answers and similar features are becoming increasingly prominent. Measuring exposure within an AI-generated response remains difficult, but measuring what happens after someone lands on your site is non-negotiable if you want to run your GEO and SEO strategy with genuine rigour.
Measure What Drives Your Content Strategy: Key Events, Conversions and Data Quality
Well-implemented GTM tracking helps you build a genuinely actionable picture:
- Acquisition: landing pages, traffic sources and audience segments.
- Usage: scroll depth, key interactions and clicks on primary CTAs.
- Outcome: submitted forms, booked meetings and demo requests.
In other words, even where AI visibility remains partially opaque, the quality of your on-site data is precisely what transforms that visibility into measurable business value.
FAQ: Installing Google Tag Manager
Where should I place the script and the noscript so everything loads correctly?
Paste the script snippet into the <head> section — as high as possible, ideally after your <meta> and <link> tags and before any other scripts. Place the noscript snippet immediately after the opening <body> tag. Ensure both blocks are present on every page template across your site.
How can I check that GTM is installed correctly?
To verify that Google Tag Manager is installed correctly, start with Preview mode (Tag Assistant) in GTM: enter the URL of the page you wish to test, then confirm the "Connected" status and that the container is detected on the page. Next, check in the debugger that the Page View event appears and that expected tags fire once only. As an additional check, inspect the page source: the script snippet should be present in the <head>, and the noscript immediately after the opening <body> tag.
Why does the container load, but some tags do not fire?
The most common reasons are: an overly restrictive trigger, conditions based on unstable DOM elements, an incorrectly configured variable, a paused tag, an unpublished version, consent blocking the tag from firing, or caching issues (you may be testing a page that does not yet include the latest published version). Use Preview mode to see exactly which event occurs and why the tag failed to fire.
How do I prevent double tagging after a redesign or the installation of a new plugin?
Apply one simple rule: one implementation source per tag. Before and after any significant change, audit where tags are injected — theme files, modules, native integrations and hard-coded scripts. Then run a complete user journey in Preview mode and confirm that every critical event appears once only.
Can I verify a property in Search Console using a tag deployed via a tag manager?
Yes, in certain scenarios this is possible, depending on the verification method chosen and your ability to inject the required tag. In practice, prioritise a stable verification method — one that is not dependent on a specific environment, cache state or partial template — and document it clearly. For a broader understanding of how visibility signals and on-site tracking work together, our guidance on Google Search Console and Google Tag Manager provides a useful reference.
To explore more SEO, GEO and digital marketing topics with a practical, operational approach, browse the full range of resources on the Incremys Blog.
.png)
.jpeg)

%2520-%2520blue.jpeg)
.jpeg)
%20-%20blue.jpeg)
.jpg)
.jpg)
.avif)