Guide

How to Set Up Google Tag Manager on Your Website

Google Tag Manager (GTM) is a free tool that lets you add, edit, and manage tracking code on your website without needing to modify the site’s code every time. Instead of asking a developer to add a new analytics script or advertising pixel, you do it yourself through GTM’s interface — and it goes live on your site within minutes.

Once set up, GTM becomes the central hub for all your tracking: Google Analytics, Facebook Pixel, LinkedIn Insight Tag, Google Ads conversion tracking, and any other script that needs to fire on your website. This guide walks you through setting it up from scratch.

Creating your GTM account and container

Go to tagmanager.google.com and sign in with the same Google account you use for Google Analytics and Search Console. Click “Create Account” and enter your account name (typically your company name) and your website’s URL. GTM uses “containers” — one container per website — so give the container a name that clearly identifies which site it belongs to.

Select “Web” as the target platform and click Create. Google will display your container code: two snippets of JavaScript that need to be installed on every page of your website. The first snippet goes in the head section, as high as possible. The second goes immediately after the opening body tag. This is the only time you’ll need a developer to touch the code — after this, everything else happens through the GTM interface.

If you’re using WordPress, the GTM4WP plugin or Insert Headers and Footers plugin makes it easy to add the container snippets without editing template files directly. For other platforms, most have a “custom code” or “header/footer scripts” section in settings where you can paste them.

Adding your first tag: Google Analytics 4

With your container installed, you can start adding tags. In GTM’s workspace, click “Tags” in the left menu, then “New”. Choose “Tag Configuration” and select “Google Tag” (previously called “GA4 Configuration Tag”). Enter your GA4 Measurement ID — found in GA4 under Admin > Data Streams > your web stream. Set the trigger to “All Pages” so GA4 fires on every page of your site.

Before publishing, use GTM’s Preview mode (the “Preview” button in the top right) to test your tag. Preview mode opens your website with a debugging panel showing which tags fire on each page. Verify that your GA4 tag fires correctly, then close the preview and click “Submit” in GTM to publish your changes live.

Once live, check Google Analytics 4’s Realtime report to confirm data is flowing in. Open your website in another tab and watch for your visit to appear in GA4’s Realtime overview. If it appears, your GA4 setup through GTM is working correctly.

Adding conversion tracking and other tags

The real value of GTM comes when you start adding event tracking and conversion tags without touching your code. To track a contact form submission, for example, create a new tag, set it to fire on a GA4 Event, and configure a trigger based on the “Form Submission” trigger type, filtering to the specific form on your contact page. Name the event something meaningful like “contact_form_submit” and you’ll see it in GA4’s Events report.

For advertising pixels like Facebook (Meta) Pixel or LinkedIn Insight Tag, GTM has built-in templates or you can paste the pixel’s base code as a Custom HTML tag firing on All Pages, then add separate event tags for specific actions like purchases or lead form submissions.

Keep your GTM container organised as it grows. Use consistent naming conventions for tags, triggers, and variables (for example: “GA4 — Contact Form Submit” for the tag, “Trigger — Contact Form Submit” for the trigger). Add notes to each tag explaining what it tracks and when it was added. A well-organised GTM container is far easier to maintain and audit over time.

FAQs

Common questions.

Do I need GTM if I already have Google Analytics installed directly?
Not necessarily — but GTM makes it much easier to manage tracking over time. If you only need Google Analytics and nothing else, direct installation is simpler. But as soon as you want to add a second tracking script (an advertising pixel, a heatmap tool, a live chat tracker), GTM becomes the better solution. It consolidates all your scripts in one place and eliminates the need to edit code every time you add or change something.
Will GTM slow down my website?
GTM itself loads asynchronously, meaning it doesn’t block your page from loading. However, the tags you load through GTM can add to page load time, particularly heavy scripts like advertising pixels and analytics tools. Keep the number of tags lean, use trigger filtering so tags only fire when necessary, and regularly audit your container to remove unused tags.
What’s the difference between GTM tags, triggers, and variables?
Tags are the scripts or tracking codes you want to run (a GA4 tag, a Facebook Pixel tag). Triggers define when a tag fires — on all pages, on a specific page, when a form is submitted, when a button is clicked. Variables store values used by tags and triggers — things like page URLs, form field values, or click element IDs. Tags fire when their triggers fire, and triggers and tags can both use variables to make their conditions more precise.
Related guides

More on web design & ux.

Want a hand putting this into practice?

Book a free, no-obligation consultation with a Norwich-based specialist.

Book a free consultation
Get started

Let's put your business in a better light.

Book a free, no-pressure consultation. We'll talk through your goals and tell you honestly what we'd do — whether you work with us or not.

  1. 01
    Tell us a bitFill in the form — two minutes, tops.
  2. 02
    We'll call you backWithin one working day, no pressure.
  3. 03
    Get a clear planHonest advice and a fixed quote.

Free · No obligation · We reply within one working day

Book a free consultation