Closed-loop GTM attribution: passing first-touch UTMs and GCLIDs from website to revenue
If marketing measures form submissions in Google Analytics while sales tracks revenue in a CRM, neither team can prove which channel pays back. Closing the loop requires four concrete pieces of plumbing: write-once first-touch capture on arrival, a shared lead identifier, verified server-side events and offline conversion uploads tied to real revenue.
Francisco Contreras · Founder, Machina
4 min read

Why default website tracking loses attribution before the form submits
Example: Suppose a buyer clicks a Google Ad into /services/go-to-market?gclid=abc&utm_source=google&utm_medium=cpc, reads a case study, checks a guide page, and then submits a form on /contact. By the time they reach /contact, the URL query string is gone. Without first-party persistence, your CRM logs the lead as "Direct" and your ad account never learns that the click turned into a $40,000 deal.
In our 66,000-word, 16-chapter audit of one live GA4 property, How to Build a World-Class GA4 Setup, we documented concrete configuration defects that silently break attribution: a server-side endpoint pointed at a 404 hostname and GA4 event retention left at its default 2-month setting (standard GA4 properties allow up to 14 months for Exploration event data). On that single site (29 leads), 20 leads (69%) carried a GA client ID while 9 (31%) did not; the cause of the missing 31% was not established.
Four steps to engineer closed-loop attribution
- 1
Capture first-touch metadata on entry
Run a lightweight first-party script on every page that checks for UTMs, click IDs (gclid,fbclid,wbraid,gbraid), landing path and external referrer. Write them once to first-party storage so internal navigation never overwrites the original source. Validate your tag rules first with our free UTM Builder. - 2
Attach a shared lead_id at submission
When the visitor submits a form, generate a deterministiclead_idand post both the contact fields and the persisted attribution payload to your backend route—never relying on browser pixels alone. - 3
Write immutable CRM properties
Storefirst_touch_*andgclidin write-once CRM properties alongside mutablelast_touch_*fields. Never overwrite first-touch attribution when a prospect downloads a second guide three weeks later. - 4
Upload verified offline conversions
When a deal hits Qualified Opportunity or Closed-Won (or a booked job completes), fire an automated upload sending the stored click ID, hashed user-provided identifiers and actual dollar value back to Google Ads via Offline Conversion Imports and Enhanced Conversions for Leads.
Enhanced Conversions for Leads and Consent Mode
Relying on gclid alone misses conversions where click parameters are stripped or unavailable. Google Ads Enhanced Conversions for Leads extends standard offline conversion import by matching hashed, user-provided first-party data (such as email address or phone number) captured on your lead form back to signed-in Google accounts.
When uploading offline conversions—especially for visitors in the EEA, UK or other consent-governed jurisdictions—populate the required consent parameters alongside Google Consent Mode. Consent Mode lets your tags and uploads pass each visitor’s consent choice to Google, so conversions are only used in ways that visitor allowed.
FAQ
Frequently asked questions
Will every form lead carry a first-party GA client ID or click ID?
No. In our audit of one live GA4 property (29 leads), 20 leads (69%) carried a GA client ID and 9 (31%) did not, without establishing the exact cause of the missing 31%. Skip missing client IDs rather than fabricating them so observed attribution stays trustworthy, and pair click IDs with Enhanced Conversions for Leads where consent allows.
Does closed-loop attribution work for phone-call-driven local businesses?
Yes. Dynamic number insertion (DNI) captures the visitor’s click ID and UTM tags per call session, writes them into the CRM alongside form leads and uploads booked-job revenue back to Google Ads once the job closes.
Keep reading
Related guides
Explore related work
Next steps
Let's talk about your project
Tell us what you're working on. We'll tell you if we can help — and exactly what we'd do.
