Lead Tracking After a Website Relaunch
Every confirmed lead counted once, per site, in four tools
Read case studyMost Google Tag Manager (GTM) containers I inspect are full of legacy tags, broken triggers, custom HTML nobody remembers adding, and redundant scripts that slow the site down. I turn them into tracking that is clean, fast, and safe to change.
GTM connects the other three notes on the measurement stack: Google Analytics 4, Consent Mode V2, and Google Ads Conversion Tracking. This note covers how a container is built, how changes reach production, and what I look for when I clean one up.
GTM lets marketing deploy tags without waiting for a developer sprint. That freedom is also why most containers turn into a mess:
This builds up over years of quick fixes, agency handovers, and campaigns that ended while their tags kept firing.
A container is made of three kinds of building blocks.
| Part | What it does | Example |
|---|---|---|
| Tag | Code that sends data somewhere | A GA4 event, a Google Ads conversion, a Meta pixel |
| Trigger | The condition that fires a tag | A page view, a click, a custom data layer event |
| Variable | A value tags and triggers can read | The page path, a form ID, an order value |
Most problems in a container trace back to one of these: a tag that should not exist, a trigger that fires too often, or a variable that reads the wrong value.
The most reliable tracking does not read the page at all. The site tells GTM what happened through the data layer:
dataLayer.push({
event: "generate_lead",
form_id: "contact",
lead_type: "quote",
});
Tags that listen for this event keep working when a designer renames a button or moves a form, because they never depended on the page’s HTML. I write the data layer specification with the developers so it works as a contract: the site promises to push these events with these fields, and the container promises to rely only on them.
A container that someone else can understand starts with consistent names. A simple pattern is enough if everyone follows it:
GA4 - Event - generate_lead.Custom Event - generate_lead.DLV - form_id for a data layer variable.I also prefer native and gallery templates to custom HTML tags. Templates are faster and sandboxed, and they declare what they are allowed to do. Custom HTML can run anything.
A tracking change is a production change and deserves the same care as code. GTM already has the tools for that:
Workspaces
Keep changes in progress apart, so two people editing at once do not overwrite each other.
Preview mode
Shows which tags fired on each event, with which values, before anything is published.
Versions
Every publish creates a version. With a clear name and description you can see what changed, and roll back to the last good version in one step.
Environments
Let a staging site load the next version of the container before production does.
The idea is the same as the staged releases in A Practical Deployment Pipeline: test somewhere realistic first, and know how you will roll back before you need to.
A server-side container moves the work of sending data to vendors out of the visitor’s browser and onto a server you control.
It pays off when the traffic, the privacy requirements, or the ad spend justify the cost. For a small site, a clean web container is often enough.
GTM sits in the middle of the measurement chain and connects the website to every measurement tool you rely on.
It reads the consent state from Consent Mode V2, takes events from the data layer, and delivers them to Google Analytics 4, Google Ads Conversion Tracking, and other ad platform pixels. A mistake in the container shows up in all of them at once.
dataLayer = [] placed below the GTM snippet replaces the array the container listens to, so later pushes never reach it.Bad tag management hurts more than analytics. Uncontrolled third-party scripts make pages slower, open security holes, and can put the site in breach of privacy law.
A well-built container gives the marketing team room to move quickly while the engineering team can trust that the site stays fast, secure, and maintainable.
1. Audit the current container
I look at how efficiently tags fire, what each script costs in page load, security risks, unused items, and broken triggers.
2. Standardize the data layer
Together with the developers, so tracking reads clean data objects instead of fragile page elements.
3. Build and consolidate tags
With native templates, shared variables, and server-side endpoints where they are justified, to keep the container small.
4. Validate
Every tag, parameter, and consent state is checked across devices in Preview mode and network debuggers before publishing.
5. Hand off
With container documentation, a data layer reference, and a publishing workflow the team can operate safely.
If you want a second look at it, hire me.
Every confirmed lead counted once, per site, in four tools
Read case studyNo health data sent to Google, bookings measured
Read case studyConsent to conversion, end to end, in 2 days
Read case study8+ issues fixed in 2 days, every conversion verified
Read case studyOne event standard across every data flow
Read case studyNext step
See how I work and what it costs, or email me. I usually reply within one working day.