How to Install Google Tag Manager on Your Website
Google Tag Manager is a “box” for all the tracking codes on your site: Google Analytics, Google Ads conversions, social media pixels. You install the container code once, and from then on you add and change tags in the interface — without editing the template.
Here’s the installation step by step: create an account and container, add the code, set up your first tag, test it in Preview mode and publish.

Step 1. Create an account and container
- Open tagmanager.google.com and sign in with your company Google account.
- On the Accounts tab, click Create Account.
- Enter the account name — usually your company name — and country.
- Enter a container name (your site address works well) and choose Web as the target platform.
- Click Create and accept the terms of service.
One account per company, one container per website. If you have several sites, each usually gets its own container.
Step 2. Add the container code to your site
Once the container is created, Tag Manager shows two code snippets and an ID in the format GTM-XXXXXXX.
- The first snippet, with a
<script>tag, goes as high as possible in the<head>of every page. - The second snippet, with a
<noscript>tag, goes immediately after the opening<body>tag.
If your CMS has a field for the Tag Manager ID — in the template or extension settings — just paste GTM-XXXXXXX there, and both snippets will be added automatically. You can always reopen the code by clicking the container ID at the top of the workspace.
Step 3. Add a Google tag for Analytics
- In the workspace, open Tags and click New.
- In the tag configuration, choose Google Tag and paste your Google Analytics 4 stream ID in the format
G-XXXXXXXXXX. Where to find it — in the article on installing Google Analytics 4. - As the trigger, choose Initialization – All Pages.
- Give the tag a clear name, such as “GA4 — Google tag”, and save.
If the Analytics code was previously added directly to your site template, remove it — otherwise visits will be counted twice.
Step 4. Test in Preview mode
- Click Preview at the top of the workspace.
- Tag Assistant opens: enter your site address and connect. Your site opens in a new tab in debug mode.
- Go back to the Tag Assistant tab: your Google tag should be listed among the tags that fired.
- Browse a few pages and make sure the tag fires on each one.
Only you see Preview mode; visitors to your site notice nothing.
Step 5. Publish the container
- Click Submit in the top right corner.
- Fill in the version name and description, such as “GA4 connected”. Six months later, descriptions like this make it easy to see what changed and when.
- Click Publish.
Until the container is published, the tags don’t work on your site, even if everything fired in Preview.
How to keep your container tidy
- Name tags, triggers and variables using one pattern: “service — what it does”.
- Test changes in Preview before every publish.
- Give contractors access through User Management in Admin, not your password. Publish rights only for those who really need them.
- Don’t paste code from unverified sources into Custom HTML tags: it runs on your site for every visitor.
Once your container is running, you might consider loading tags from your own domain — see the article on Google tag gateway.
Common mistakes
- The container is created but not published.
- Analytics is both in the template and in Tag Manager — double counting.
- Two different containers on the site, and nobody remembers why the second one is there.
- The Tag Manager account is registered to a contractor, and access is lost when the work ends.
In short
- Create an account and a web container on your company account.
- Add the two snippets: in
<head>and right after<body>— or paste the ID into your CMS field. - Add a Google tag with your GA4 ID and the Initialization – All Pages trigger.
- Test in Preview.
- Click Submit → Publish.
If your site template has collected codes from various services and it’s unclear which of them work, we can set up Google Tag Manager: move your tags into a container and set up tracking for forms, clicks and calls.