Sultan Kautsar

Lead Tracking After a Website Relaunch

A German marketing agency relaunched its two websites, and from that day no lead reached its analytics or ad accounts. I rebuilt the tracking so every confirmed enquiry counts once, per site, in GA4, Google Ads, Meta, and LinkedIn, and nothing loads before consent.

Lead trackingMarketing agency

6 min read

The Client

A German marketing agency with two websites: its main site and a separate site for one of its specialist services. The agency rebuilt both in Next.js. They share one Google Tag Manager container, and a CCM19 banner handles consent.

The agency’s owner set the rules before I started. Leads from the two sites are reported separately. A form counts only after the server confirms it, never twice. Google runs in basic Consent Mode V2, Meta and LinkedIn stay blocked until the visitor accepts ads, and consent must never stop a form from sending. No form contents or personal data go into events or URLs.

The Problem

The new sites pushed a clean generate_lead event after every successful enquiry, but the tracking behind them still described the old site.

  • No leads since the relaunch. The triggers waited for a submit button and a thank-you page from the old website builder. That page now returns a 404, so nothing fired.
  • Double counting. The old booking conversions fired on the click and again on the thank-you page.
  • Broken and hard to read. One trigger used a setting that does nothing in a trigger, one tag had an ad account ID typed in by hand, names followed no pattern, and there were no folders.
  • Tags from a separate business. The container still sent data to an analytics property and an ad account that belonged to another company, left over from an older setup.
  • One analytics stream with no tag of its own. The main site’s GA4 stream received page views only through that other company’s Google tag. Removing the old tag, which the owner wanted, would have stopped page views on the main site.
  • No social platforms. Meta and LinkedIn were part of the plan, but neither was installed, and the privacy policy didn’t mention them.

What I Did

I audited the container first, exported the live version so it could be restored, and did all changes in a draft that stayed unpublished until the owner approved it.

  1. The visitor accepts analytics, ads, or both in CCM19
  2. Consent Mode V2 updates; Meta and LinkedIn scripts unblock only for ads
  3. The form sends, and the server confirms it
  4. The site pushes one generate_lead event with the form name
  5. GTM routes it by hostname
    • Main site Its own GA4 property, Ads lead, Meta, and LinkedIn conversions
    • Service site Its own GA4 property, Ads lead, Meta, and LinkedIn conversions

One event, split by site
All five forms on the two sites push the same generate_lead event once the server answers OK. GTM splits it by hostname, so each site has its own GA4 property and its own conversion actions, named with the site (www - Lead, service - Lead). Phone and email clicks became click_phone and click_email on both sites.

Primary and secondary conversions in Google Ads
Submitted forms are the primary conversion, and phone and email clicks are secondary, so campaigns bid on real enquiries. Ads tracks them directly from the site. GA4 is linked to the same ad account, but its leads aren’t imported as a second primary conversion, which would count each lead twice.

A new stream instead of a borrowed tag
I couldn’t get admin access to the other company’s Google tag, so I gave the main site a new web stream in its existing GA4 property, with a Google tag of its own. History, the Ads link, and the key event stayed in place, and the old stream is kept, unused.

Meta and LinkedIn behind ads consent
I added the Meta Pixel and LinkedIn Insight Tag through GTM with lead and contact events for both sites. Each also got its own service in CCM19, so the banner blocks their scripts until the visitor accepts ads, on top of the consent check in GTM. The privacy policy got sections for both, sent as a pull request to the site’s repository and merged before the container went live.

Cleanup without losing anything
Tags, triggers, and variables now follow one naming pattern and sit in one folder per platform. The other company’s destinations came out. Dead items were first paused and moved to a deprecated folder, and deleted only once the owner confirmed which accounts were still in use.

Testing with real submissions
I wrote headless browser scripts that load the draft container, log every tracking request, and stop it before it leaves the browser. They checked both sites on desktop and mobile: before consent, after rejecting, after accepting, on client-side navigation, and for phone and email clicks. Then I sent a marked test enquiry through each of the five forms.

Those test leads showed something the settings pages didn’t. Meta’s automatic advanced matching and Google’s automatic Enhanced Conversions were adding a hashed copy of the visitor’s email and name to every lead, which broke the owner’s rule and contradicted the new privacy policy. I turned off automatic matching in the Meta tag, switched off the user-provided data setting on every Google tag, and ran the submissions again until no email data went out.

Handover
After the publish I repeated the checks on the live sites and delivered a German handover pack: a written setup description with every account, conversion, and test result; a step-by-step picture guide the owner can use in Miro for teaching; and a script for an explainer video.

The Stack

Nothing new was hosted, and no paid tools were added.

Layer Tool Role
Websites Next.js Two sites; the server confirms each form, then pushes it
Consent CCM19, Google Consent Mode V2 (basic) Banner, per-category consent, script blocking
Tag management Google Tag Manager One container for both sites, split by hostname
Analytics Google Analytics 4 One property per site, generate_lead as key event
Advertising Google Ads, Meta Pixel, LinkedIn Insight Tag Lead and contact conversions per site
Code changes GitHub pull request Privacy policy update, reviewed before merge
Testing Playwright scripts, GTM API, Tag Assistant Every consent state, device, form, and outgoing value

What Is Left

Some limits stayed on purpose, and the handover names each one.

  • When a visitor accepts ads after the first page has loaded, Meta and LinkedIn start on the next page. A lead sent before that reaches Google only.
  • Server-side conversions for Meta and LinkedIn are out of scope. I listed the options and their costs for the owner to decide.
  • Enhanced Conversions and advanced matching stay off until the privacy policy covers them.
  • The form’s spam trap answers bots with a success message, so a bot that fills it counts as a lead. The fix belongs in the site’s code.

The Result

Before After
No leads recorded since the relaunch Every confirmed enquiry counted, from all 5 forms
Booking conversions counted twice One conversion per lead, only after the server confirms
Both sites’ leads mixed or missing One GA4 property and separate conversions per site
Data sent to another company’s accounts No requests to those accounts, checked on the live site
No Meta or LinkedIn tracking Both installed, blocked until the visitor accepts ads
Hashed email and name added to test leads No email data on submit, checked again after publishing
Privacy policy without Meta or LinkedIn Both described, merged before the container went live
  • No tracking at all after a rejection. With “reject all”, the container doesn’t load and the sites send no tracking requests.
  • Live one day after the last access came in. I published the container a day after the last account invitation arrived, and the handover followed the next day.

If your tracking stopped counting after a relaunch, hire me.

Similar Problem?

Tag management, data layers, and Consent Mode V2 that fire once, with consent, and Google Ads can bid on.

More Work

Next step

Have a project in mind? Let's talk.

See how I work and what it costs, or email me. I usually reply within one working day.

Write to Me

Tell me about your project or idea. I usually reply within one working day.