Google Tag Manager

5 posts

Google Tag Manager (GTM) lets you manage website tags, including analytics code, advertising pixels and tracking scripts, in one place. Without it, each new tracking implementation requires a developer to write, test and deploy code. With GTM, you add a container to the website once, then make subsequent changes through its interface.

This section covers GTM as a practical tool: how to set it up, how its components work, how to test it and which mistakes undermine measurement.

Three key concepts

GTM is built around three elements:

  • Tag: what is sent. For example, a GA4 event or a Meta pixel.
  • Trigger: when it is sent. For example, when a page loads, a button is clicked or a form is submitted.
  • Variable: which data is sent with it. For example, the page URL, clicked text or order value.

In practice, the sequence is always the same: decide what you want to measure, identify the event that represents it, then configure the tag.

What is dataLayer and why does it matter?

dataLayer is an intermediary layer through which your website passes information to GTM. Details such as order value, product name and whether a user is registered are written to it, and GTM reads them from there.

The alternative is to read data from page elements, such as extracting a price from the text displayed on screen. This can work, but it is unreliable: a design change can break tracking, and you may not notice for months. Reliable measurement, particularly in e-commerce, should be built on dataLayer.

Common tracking setups

For most websites, a useful basic setup tracks form submissions, phone number clicks, WhatsApp button clicks, email link clicks, file downloads (PDFs, price lists), outbound link clicks, video views and scroll depth. For e-commerce, add product views, basket additions, checkout starts and completed purchases.

Trying to measure everything can also cause problems. As the number of tracked events grows, reports become cluttered and nobody uses them. The rule is simple: only track events that inform decisions.

Testing before publishing

One of GTM's most useful features is Preview mode: it lets you test changes on your website before publishing and see which tags fire and what data they send. GA4's real-time report provides an additional check.

Check three things: does the tag fire, does it fire at the right moment, and does it send the correct data? The third is the most commonly overlooked: a tag may fire successfully while sending an empty order value or one in the wrong format.

Mistakes that compromise your data

  • Duplicate tracking. GA4 has been added both directly to the website code and through GTM, so the same events are counted twice.
  • Incorrect trigger. "All Pages" is selected, even though the event is only relevant on one page.
  • Sending personal data. If a URL contains an email address or phone number, that information must not be passed to analytics.
  • Unnamed versions. Without a record of what changed, it is harder to roll back when something goes wrong.
  • Ad blockers. Tracking will never work for some users. Keep this in mind when interpreting reports.

Impact on website speed

GTM itself is lightweight, but the scripts inside it can be resource-intensive. Over time, dozens of pixels and tracking scripts are added to the container, while tags from old campaigns remain. This means unnecessary code loads on every page view, slowing down the website.

A simple routine helps prevent this: review the container once or twice a year and remove unused tags, run non-essential scripts after the page has loaded, and ask "How will this help me make the decision I need to make?" whenever you add a new tag. Keeping the container tidy improves both website speed and the clarity of your reports.

Access and governance

Anyone with access to GTM can add code to every page of your website. That brings both power and risk. Follow a few practical rules: restrict access, publish changes as named versions, establish a naming convention for the container's tags (for example, "GA4: form submitted"), and export a backup of the current container before making major changes.

When is GTM unnecessary?

If you only need GA4 on a simple, single-page website, adding the code directly is sufficient. GTM becomes more useful as you track more events, use several advertising platforms or need frequent changes. It is perfectly reasonable to introduce GTM when you need it, but migrating later takes longer than setting it up from the start.

Where to start

Follow this sequence: create the container and install it on your website, connect GA4 only through GTM to avoid duplicate tracking, add 3–5 key events, test each one in preview mode, then name and publish the version. For reporting, see the Google Analytics section. The articles below explain each step in detail.

Posts in this topic

Need digital marketing support for your business?

Let's talk: I can help with everything from strategy to ad management.

Message me