Executive Summary
If you cannot accurately measure how many sales are coming from your Meta Ads or Google Ads campaigns, there is an “attribution gap” between your advertising data and your sales database (CRM). In this system proposal, we build an attribution telemetry architecture that stores the ad parameters (UTMs) a user arrived with in browser cookies and automatically passes that data into custom fields in your CRM when the user submits a form.
Who Is This For?
- Companies spending Google Ads and Meta Ads budgets without being able to see which keyword or creative asset is actually driving sales.
- Software developers who lose UTM source data when pushing form submissions into the CRM.
- Growth leaders who want to establish closed-loop revenue reporting.
Key Concepts
- First-Touch Attribution: A model that credits the ad campaign (UTM) through which a user first encountered your brand as the true source of the sale.
- CRM Ingestion: The error-free recording of external data arriving via API or webhook channels (e.g., UTM cookies) into the corresponding fields on CRM contact records.
The Problem: Lost UTM Parameters and Incomplete Attribution Data
On a conventional website, when a user clicks an ad and lands on the site, the URL looks like this:
www.korayyalcin.org/?utm_source=meta&utm_medium=cpc&utm_campaign=proptech_lead
However, as soon as the user navigates to other pages on the site (e.g., About, Contact), the UTM parameters in the URL disappear. When the user fills out the contact form, only First Name, Last Name, Phone is sent to the CRM; the ad source information is lost entirely. As a result, the marketing team never learns which ad actually generated the sale.
The Solution: A Cookie-Based UTM Ingestion System
In the infrastructure we propose, a lightweight JavaScript snippet runs when the user first lands on the site, detects the UTM parameters in the URL, and writes them into browser cookies. Regardless of which page the user eventually submits a form on, the data stored in the cookies is read and sent to the CRM through hidden form fields.
User Clicks Ad → UTM Present in URL → JS Snippet Writes to Cookie (30-Day Expiry)
User Browses Site → Fills Out Contact Form → JS Reads Cookie → Writes to Hidden Form Fields → Record Created in CRM with UTM Data
System Components and Implementation Steps
- Deploying the Cookie Writer Script: A script built on the following logic is added to the site’s
headeror deployed via Google Tag Manager to fire on all pages:- The URL is checked for the
utm_source,utm_medium, andutm_campaignparameters. - If found, these values are saved to cookies under names such as
ky_utm_source,ky_utm_medium, etc., with a 30-day validity period.
- The URL is checked for the
- Creating Hidden Form Fields: The following hidden input fields are added to every form on your website:
<input type="hidden" name="utm_source" id="utm_source"> <input type="hidden" name="utm_medium" id="utm_medium"> <input type="hidden" name="utm_campaign" id="utm_campaign"> - Populating the Form with Cookie Values: When the form loads, the values stored in the cookies are read and automatically written into these hidden inputs. When the form is submitted, the data is forwarded to the CRM integration service (Make or a custom API endpoint) along with the UTM information.
- Defining the CRM Fields: In the CRM (Zoho, HubSpot, or Bitrix24), three custom text fields named
UTM Source,UTM Medium, andUTM Campaignare created, and the incoming data is written to these fields.
System Security and Data Accuracy
In this system, API keys and database credentials are never stored on the client side. Cookie write and read operations take place entirely within the local browser. Data transfer to the CRM is completed through a server-side integration layer, masked behind a secure token.
Citation
Yalçın, K. (2026). A Guide to Writing UTM Parameters into Your CRM Database. KorayYalcin.org Publications & Research.
Sources
- B2B Marketing Attribution & GTM Telemetry Guide 2026.
Related Articles
Book a System Architecture Review
Let’s build your advertising and CRM data telemetry infrastructure together. To design your ad attribution models, deploy GTM UTM cookie writer scripts, and build Looker Studio ROI dashboards, you can submit a System Architecture Review Request.