How to Pass UTM Parameters Into Your CRM (Salesforce, HubSpot, Pipedrive) and Keep Them on the Lead
Getting UTM values into a CRM is half the job; keeping them on the record through conversion, enrichment and updates is the other half. This guide covers the general pattern and the specifics for Salesforce, HubSpot and Pipedrive, based on each vendor's documentation.
In short
Create a CRM field for each UTM parameter, capture the values when the visitor lands, carry them through the form submission in hidden fields or an API call, and map them onto the lead. Then protect them: keep first-touch fields write-once, map them through lead conversion, and stop imports and integrations from overwriting them.
Marketing can see which campaigns drive sessions, sales can see which leads close, and nobody can join the two because the lead record does not say where the person came from. Or it did, briefly, until the lead was converted, enriched or re-submitted a form and the value disappeared. This guide covers how to pass UTM parameters into a CRM and, just as important, how to keep them on the record afterwards. It uses Salesforce, HubSpot and Pipedrive as examples and sticks to what each vendor documents. EndFrame has no native app for any of them; where it fits, that is noted at the end.
The pattern every CRM follows
- 1Create fields. One per UTM parameter, plus click IDs (gclid, fbclid) and landing page if you want them. Decide on first-touch, last-touch or both, and name fields accordingly.
- 2Capture on arrival. Read the parameters from the landing URL and store them in first-party storage, because the form is often several pages later.
- 3Carry them with the submission. Hidden form fields are the usual route; an API call from your server works too.
- 4Map them to the record. The form tool or integration writes each value to the matching CRM field.
- 5Protect them. Stop later activity from overwriting or clearing them, and carry them through any conversion between objects.
Steps two and three are covered in detail in how to capture UTM parameters in hidden form fields. The rest of this guide focuses on the CRM side.
Salesforce
Salesforce's lead object has a standard Lead Source picklist but no UTM fields, so create a custom text field for each parameter. If you use Web-to-Lead, Salesforce generates the form HTML for you, and Salesforce's help documentation describes setting values with hidden inputs: standard fields use their API name in lowercase, and custom fields use the custom field ID as the input name. Your capture script fills those hidden inputs before submission. To also add the lead to a campaign, Salesforce documents two hidden fields, the Campaign ID and the Campaign Member Status; without a member status, the lead is not associated with the campaign.
The step most teams miss is lead conversion. When a lead converts, its custom field values only move to the contact, account or opportunity if an admin has mapped them under the lead's field settings. Salesforce documents type rules for this mapping, for example some field types can only map to a field of the same type. Map the UTM fields to the contact and opportunity, or the source disappears at the exact moment the lead becomes revenue.
HubSpot
HubSpot does part of the work itself. With its tracking code on your pages, it sets Original Traffic Source and Latest Traffic Source on each contact, with drill-down properties that include the utm_campaign value for paid, social, email and other campaign traffic. Those drill-downs are set automatically and cannot be edited by hand. What HubSpot does not document is a property per raw UTM value. Its own guidance is to create custom properties and fill them from hidden form fields, and HubSpot forms can populate hidden fields from a query string that uses each property's internal name.
Two HubSpot details matter. Query-string auto-population reads the URL of the page with the form, so it does not help when the visitor arrived on a different page. And if the form pre-fills known values for returning visitors, HubSpot notes that a hidden field's value may be overwritten depending on its field type. Our article on UTM tracking in HubSpot covers how the source properties are classified and where they fall short.
Pipedrive
In Pipedrive, create custom fields for the UTM values. Pipedrive's developer documentation states that deals, persons, organisations, products and projects can carry custom fields, that leads inherit all the custom fields defined for deals, and that each custom field is referenced through the API by a generated 40-character key specific to your account. Pipedrive's web forms documentation, at the time of writing, does not describe hidden fields or UTM capture, so the reliable route is to create or update the lead or deal through the API, or through an automation tool you already use, with the UTM values written to those custom field keys.
The three CRMs side by side
| Salesforce | HubSpot | Pipedrive | |
|---|---|---|---|
| Built-in source field | Lead Source picklist | Original and Latest Traffic Source with drill-downs | None for UTMs |
| Raw UTM storage | Custom fields | Custom properties | Custom fields |
| Form route | Web-to-Lead hidden inputs | Hidden fields, filled by script or query string | API or automation tool |
| Where values get lost | Lead conversion without field mapping | Pre-fill overwriting hidden values | Fields not written by the integration |
Keeping the values on the record
- Make first-touch fields write-once. A later form submission with empty hidden fields, or with a different campaign, should not replace the original. Most CRMs let you do this with a workflow or validation rule that only sets the field when it is empty.
- Keep a separate latest-touch set if you need it, so you are not tempted to overwrite the first-touch values.
- Check every integration's field permissions. Enrichment tools, list imports and two-way syncs are frequent culprits for clearing or replacing values.
- Carry values across objects. Map lead fields to contacts and opportunities, or copy them with automation, so revenue reports can group by source.
- Normalise on the way in. Values are case sensitive in most tools, so lowercase them before they reach the CRM.
Test the full round trip
Do not sign off the setup from the browser alone. Build a tagged link with distinctive test values, open it in a private window, browse two pages and submit the form with a test email address. Then open the record in the CRM and check every field. Next, convert or progress the record the way your sales team would, for example converting the Salesforce lead or moving the Pipedrive lead to a deal, and check the values again on the resulting records. Finally, submit a second form as the same person from an untagged visit and confirm the first-touch fields did not change. Ten minutes of testing here saves months of reports with a blank source column.
Using the data once it is there
With UTMs on the lead, you can report pipeline and revenue by campaign rather than stopping at clicks and sessions. The same records are what you need to send qualified leads and sales back to ad platforms, covered in offline conversion tracking, and to answer the question this whole exercise is about, set out in lead source tracking. For the reporting side, see connecting campaigns to leads and revenue.
Where EndFrame fits
EndFrame's tracker captures UTMs, click IDs and form submissions on your site and stores them against the visitor, so the source is attached to the lead without a capture script per form. It does not have a native Salesforce, HubSpot or Pipedrive app. Instead, a custom webhook can send each lead with its campaign fields to any endpoint you choose, such as your own integration layer or an automation tool that writes to the CRM fields described above.
Frequently asked questions
Does Salesforce have standard UTM fields?
Not on the lead object. Salesforce has a standard Lead Source picklist, but the individual UTM values need custom fields. Those custom fields then need mapping for lead conversion if you want them on the contact, account or opportunity.
Does HubSpot store UTM values on the contact automatically?
HubSpot uses UTM values to set its Original and Latest Traffic Source properties and their drill-downs, which carry the campaign name. To keep each raw UTM value as its own property, HubSpot's documentation points to custom properties filled through hidden form fields.
How do I add UTM fields to Pipedrive?
Create custom fields for them. Pipedrive's API documentation notes that leads inherit all custom fields defined for deals, and each custom field is written through the API using its own generated key. Pipedrive's web forms documentation does not describe hidden UTM fields at the time of writing.
Why do UTM fields go blank after the lead is updated?
Something else is writing to them: a later form submission with empty hidden fields, an import, an enrichment tool or a sync. Make first-touch fields write-only-if-empty and check which integrations have permission to update them.
Sources
- 1.Pass hidden parameters in Web to Case and Web to Lead - Salesforce Help
- 2.Associate a Web-To-Lead to a Campaign - Salesforce Help
- 3.Map Custom Lead Fields for Lead Conversion - Salesforce Help
- 4.Set property values with hidden form fields - HubSpot Knowledge Base
- 5.Understand Original and Latest traffic source properties - HubSpot Knowledge Base
- 6.Custom fields - Pipedrive API documentation
Try EndFrame
Add a server-side path for your conversions.
EndFrame collects events first-party and forwards conversions server-side to Meta, GA4, TikTok, and webhooks with event-ID deduplication — then credits each conversion to its campaign, with the visit-to-conversion path you can audit.
No credit card required