Google Tag Manager

Google Tag Manager (GTM) is a free tool that lets you add and manage tracking codes on a website from one web interface. Instead of editing site code each time, you install one GTM container and then control analytics, advertising and other tags from inside it.

How it works

GTM is built around a few core ideas:

  • Container: a snippet of code added to every page once. Everything else is managed inside it.
  • Tags: the code you want to run, such as a Google Analytics 4 tag, an advertising pixel or a heatmap script.
  • Triggers: rules that decide when a tag fires, such as on every page view, on a form submission or when someone clicks a specific button.
  • Variables: values GTM reads to make decisions, such as the page URL, the text of a clicked link or details passed from the site.
  • Data layer: a structured object on the page where the website can share information, such as order values, with GTM.

Changes are saved as versions, so you can preview them, publish them and roll back if something breaks.

Why it matters for SEO

GTM is not a ranking tool, but it plays a big part in measuring SEO results. It makes it easier to set up conversion tracking for actions such as enquiries, phone number clicks and downloads, so you can see which organic landing pages generate leads. It also helps you track scroll depth, outbound link clicks and other engagement events.

How to set it up

  1. Create a GTM account and a web container for your site.
  2. Add the two container snippets to your site: one in the head and one just after the opening body tag. Many CMS plugins can do this for you.
  3. Add a GA4 configuration tag using your measurement ID, set to fire on all pages.
  4. Create event tags and triggers for key actions such as form submissions.
  5. Use Preview mode to check that each tag fires correctly.
  6. Publish the container with a clear version name.

GTM and SEO content

It is possible to use GTM to inject changes such as schema markup, canonical tags or title changes with JavaScript. Google can often render these, but it relies on rendering working perfectly and can be slower or less reliable than placing them in the HTML. Treat it as a temporary workaround, not a long-term solution.

Common mistakes

  • Installing GA4 both directly in the site code and through GTM, which double-counts visits.
  • Adding too many third-party tags, which slows page speed.
  • Publishing without testing in Preview mode.
  • Ignoring consent requirements: tags that set cookies should respect visitors’ choices under UK and EU privacy rules.
  • Leaving old, unused tags in the container.

Key Takeaways

  • Google Tag Manager lets you manage tracking tags from one interface without editing site code.
  • It works through a container, tags, triggers, variables and a data layer.
  • It is essential for tracking conversions from organic traffic.
  • Injecting SEO elements through GTM should be a temporary workaround only.
  • Test in Preview mode and avoid installing the same tag twice.

Related Terms

Not sure how your own site measures up? Request a free SEO review, or keep learning in the SEO Encyclopedia.