One Shared Memory for Four AI Agents
736 sessions and 28 shared memories in one versioned vault
Read case studyA 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.
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 new sites pushed a clean generate_lead event after every successful enquiry, but the tracking behind them still described the old site.
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.
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.
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 |
Some limits stayed on purpose, and the handover names each one.
| 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 |
If your tracking stopped counting after a relaunch, hire me.
Tag management, data layers, and Consent Mode V2 that fire once, with consent, and Google Ads can bid on.
736 sessions and 28 shared memories in one versioned vault
Read case studySales documents and the books in one system
Read case studyAbout 30 hacked sites cleaned, locked, and watched daily
Read case studySending stopped on its own, every site on a new key
Read case studyProducts and articles published without a deploy
Read case studyNo health data sent to Google, bookings measured
Read case studyThe company's main hiring platform, built in-house
Read case studyFive chat channels in one inbox on every phone
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.