Pipedrive
Pipedrive lead source and UTM tracking, on every form submission
Pipedrive keeps the deal. It does not keep the ad that created it. SourceTag fills hidden fields on your form with the channel, campaign, keyword and gclid, and your existing form-to-Pipedrive connection carries them onto the person record.
Your website
Script installed
SourceTag
Captures attribution
Your forms
Hidden fields sent
Pipedrive
Data arrives tagged
Your website
Script installed
SourceTag
Captures attribution
Your forms
Hidden fields sent
Pipedrive
Data arrives tagged
The problem
Pipedrive shows you the lead. It doesn't show you which campaign or keyword produced it, so you're stuck guessing what to spend more on.
How to set it up
SourceTag runs on your site and remembers how each visitor arrived. When they submit a form, hidden fields carry that history into Pipedrive, so the new contact already has its channel, source, campaign and keyword attached.
Add SourceTag to your site
Paste the script tag in your header, or use the WordPress plugin if that's easier.
Create matching fields in Pipedrive
Add contact or lead fields in Pipedrive named st_fc_channel, st_fc_detail_1 and so on. The setup guide has the full list.
Match hidden fields on your forms
Whatever builds your forms, add hidden fields with the same names so the data has somewhere to land.
Run a test lead through
Visit your site with ?utm_source=test&utm_medium=cpc, submit the form, and check the new record in Pipedrive.
What ends up on the person record
Twelve fields are always populated: st_fc_channel, st_fc_detail_1 through st_fc_detail_4, st_fc_landing_page, and the same six again with an st_lc_ prefix for last click.
The four detail fields change meaning with the channel. On Paid Search they hold utm_source, utm_campaign, utm_term and utm_content, so a click on your brand ad arrives as Paid Search / google / pi-brand-search / car accident lawyer. On Organic Search, detail 1 is the search engine and detail 2 is the referrer URL. On Direct all four read (not set). The smart field mapping is editable per channel if that order does not suit your reporting.
Optional groups add the click IDs, either combined in st_fc_click_id and st_fc_click_id_type or split into st_fc_gclid, st_fc_msclkid, st_fc_fbclid and the rest. There is also a raw UTM group and a visitor meta group with st_visits, st_days_to_convert and st_device. Turn on the groups you want in the Fields page of your dashboard before you build the Pipedrive side. The full field list has every name.
Create the custom person fields in Pipedrive
Text is the right type for everything except st_visits and st_days_to_convert, which work better as Number. Give them labels your sales team can read, like First Click Channel and First Click Smart Field 3 (Keyword), because nobody remembers what detail 3 means at 4pm.
Open Settings > Company settings > Data fields
Switch to the Person tab. These are contact-level fields, not deal fields, because the form submission creates or updates a person.
Add one custom field per SourceTag field
Start with the twelve core fields. Add the click ID and visitor meta fields only if you enabled those groups.
Check the internal name
Pipedrive generates an internal name from the label and can change it. Whatever it becomes, that is the name your integration has to map to.
st_fc_channel First Click Channel Text
st_fc_detail_1 First Click Source Text
st_fc_detail_2 First Click Campaign Text
st_fc_detail_3 First Click Keyword Text
st_fc_detail_4 First Click Ad Content Text
st_fc_landing_page First Click Landing Page Text
st_lc_channel Last Click Channel Text
st_lc_detail_1 Last Click Source Text
st_lc_detail_2 Last Click Campaign Text
st_lc_detail_3 Last Click Keyword Text
st_lc_detail_4 Last Click Ad Content Text
st_lc_landing_page Last Click Landing Page TextPipedrive's own web forms cannot hold hidden fields
LeadBooster Web Forms have no hidden field type, so there is nowhere for SourceTag to write. Use a form builder that does and send its submissions into Pipedrive through the native integration, Zapier or a webhook. WPForms, Gravity Forms, Jotform and Contact Form 7 all work.
Then map every st_ form field to the matching Pipedrive field inside that connection. A field that exists on both sides but is unmapped in the middle arrives empty, and it looks exactly like a tracking failure.
Test it with a UTM link
Open this in an incognito window, submit the form with an email address Pipedrive has never seen, then open the new person.
First Click Channel should read Paid Search, source google, campaign pi-brand-search, keyword car accident lawyer. Fields with nothing in them show (not set) rather than blank, which is how you tell a captured empty value apart from a mapping that never fired. Use a fresh person every time: an existing record can have its custom fields left untouched by your integration, which reads as a SourceTag problem and is not one.
If you want to see the values before they leave the browser, open dev tools and run window.__sourcetag.getFC() in the console. The testing guide walks through the cookie and the hidden inputs.
https://yoursite.com/contact?utm_source=google&utm_medium=cpc
&utm_campaign=pi-brand-search&utm_term=car+accident+lawyerSafari, ad blockers and long sales cycles
Safari caps JavaScript cookies at seven days. Outside the EU, Chrome, Firefox and Edge on iOS run on WebKit and do the same. A lead who clicks your ad on Monday and fills in the form nine days later arrives in Pipedrive as Direct, because the first click expired.
A server-set cookie fixes it. On WordPress, tick Enable server-side cookie setting in Settings > SourceTag. Anywhere else, run the Cloudflare Worker or point the script tag's data-server-cookie attribute at your own endpoint. The cookie then holds for up to 400 days in Safari.
Ad blockers matter less than people expect. cdn.sourcetag.io is not on the main filter lists, and when the script is blocked the form still submits normally, just without the st_ values. See ad blockers for the detail.
Reading it back in Pipedrive
Add First Click Channel and First Click Campaign as columns on your Person list view, then filter. That is the report most teams actually want, and it takes a minute rather than a project.
The fields sit on the person, not the deal. If your reporting happens at deal level, decide on day one whether to copy the values across with a workflow automation. Retrofitting it later means touching every open deal by hand.
Cost per lead by campaign is the easy report. Cost per won deal by campaign is the one worth having, and it only works if the source was on the record from the moment the person was created.
Where it usually goes wrong
Field name typos are the number one cause. The name attribute on the hidden input has to match the SourceTag field name character for character. Copy it from the Fields page rather than retyping it.
Forms loaded inside an iframe from another domain are out of reach for the script. If your form is an embed, check whether the vendor offers a JavaScript embed instead, or read the values with the JavaScript API and pass them in yourself.
Full-page caching can serve a page that was built before you added the script. Clear the cache after install and check the page source for st.js before you start debugging anything else.
How data gets into Pipedrive
SourceTag doesn't connect to Pipedrive directly. It works through your forms. Whatever form builder you use, attribution data gets submitted alongside the lead's details and flows into Pipedrive through your existing form-to-CRM connection.
Any form builder that supports hidden fields will work:
Frequently asked questions
No. Pipedrive stores what the form posts to it. If the UTM values are not in the submission, they never reach the person record. That is what the hidden fields are for.
Three parts. Create custom person fields in Settings > Company settings > Data fields, add hidden fields with the same names to your form, and map them in whatever carries the submission into Pipedrive. After that every new person arrives with its source attached.
st_fc_detail_3 for first click and st_lc_detail_3 for last click, when the channel is Paid Search. That field maps to utm_term by default, so it holds whatever your ad account puts in the keyword parameter of your tracking template.
Yes, if you enable the individual click ID group. st_fc_gclid and st_lc_gclid carry the Google Ads click ID, st_lc_msclkid the Microsoft one. Export closed deals with the click ID and upload them as offline conversions.
The cookie lasts 400 days on Chrome, Edge and Firefox on desktop. On Safari it lasts seven days unless you enable a server-set cookie through the WordPress plugin, the Cloudflare Worker, or your own endpoint.


