Refreshed and republished on September 10, 2021
This post was originally published on February 2, 2021. After this post was published, Salesforce released the ability to check if a field has been changed. Previously, the solution was to clear out the UTM field values after the flow ran. The new solution is to use the is changed feature instead of clearing out field values.The Concept
If a lead or a contact’s fields for UTM Source, UTM Medium and UTM Campaign have a value, run a Salesforce Flow to create a record in a custom object. The process will run again whenever the UTM information is updated.
UTM touchpoints displayed on the lead layout
Record detail page for a UTM touchpoint
Report preview
Dashboard preview
Planning
In order for this approach to work, there are 2 things you need to plan for:
- UTM fields for the Lead and Contact MUST be set up to be overwritten every time.
- What to do if there’s EXISTING UTM data in these fields to prevent data loss.
I recommend you review how your UTM fields are currently populated, what data currently exists in these fields and what reports/automations, etc rely on these fields. You should be able to answer these questions before getting started:
- How are the UTM fields populated?
- Do the UTM fields get overwritten?
- What are we going to do with existing data?
What to do if you have existing data
There are plenty of options on how to get this to work if you have existing data in your UTM fields. It all depends on your current setup. Here are some ideas:
- Create new fields named “First UTM Source”, “First UTM Medium”, etc. Rename your CURRENT UTM field labels (not API names) as “Last UTM Source, “Last UTM Medium”, etc. Populate the “First UTM” fields with your current data and use the “Last UTM” fields in your Flow.
- Once the UTM custom object is set up, use DataLoader.io to create records using all the existing UTM values.
Create the custom object
Create the custom object. I named by object “UTM Touchpoint”.
Create your fields
Next, create the custom fields for your custom object.
Field name | Field type |
---|---|
Lead | Lookup (Lead) |
Contact | Lookup (Contact) |
UTM Source | Text |
UTM Campaign | Text |
UTM Medium | Text |
Touchpoint Date | Date |
You can also create any other fields you want to track using this object. For example, UTM Term or UTM Content.
Create the Flow for Leads
Navigate to the Flow builder and create a new Flow. Select Record-Triggered Flow as your Flow type.
Configure the trigger to run when a a record is created or updated and after the record is saved
Select the Lead object as the starting object and add in the filters that will trigger your flow. For this example, I want to trigger the flow when UTM Source, UTM Medium AND UTM Campaign have values.

Add a decision element to the flow that will check if the UTM values are set.
Now your flow should look like this.
Add another decision element that will check if the UTM fields are updated.
Add a create records element to the Flow that will take the UTM values from the lead and set the values for the UTM Touchpoint object.
Connect the decision elements and the create records element. The final flow should look like this.
Create the flow for contacts
To create the flow for contacts, click save as on the lead flow and select save as new flow.
Edit the flow to start on the contact object instead of the lead object.
Edit the create records step to update the contact rather than the lead.
Here’s what my completed flow looks like for contacts.
Creating reports
You can create reports by using one of the predefined UTM report types. The report type “UTM Touchpoints” will allow you to pull a report of ALL UTM touchpoints for both leads and contacts.
You can group by UTM Touchpoint Date to view all the touchpoints for a specific month, day, quarter, year, etc.
Questions?
Send me a tweet @jennamolby, or leave a comment below.
Hi Adam,
Curious if you implemented this and how it’s working. I’m looking to add a similar process, but had the same question.
How did only clearing the utm values in Salesforce work out?
Thanks,
Rebecca
Hi Rebecca, I’ve updated the post to include the newest Salesforce Flow features which means you no longer have to clear out the field values for this to work. Check it out!
Hi Jenna — I’ve loved your blog for a long time!
Can this actually work with Pardot? If it’s critical that we clear the field between each touchpoint, how do you overcome the issue where: once a field is populated with a value, and synced between Pardot/Salesforce, you can’t make it blank?
Every time I’ve tried to clear field value, the value is always re-populated because, as Pardot support said, the integration prefers “something” over “nothing”. The only way I’ve been able to clear a synced field is by breaking the sync and clearing both sides separately, and re-syncing.
Can you get around that somehow?
Hi Adam, Thanks so much! yes, this can work with Pardot. The field only needs to be cleared in Salesforce and it can have a value in Pardot. You can set up your UTM fields in Pardot to use Salesforce as the master.
If you want both the fields in Pardot to always match what is in Salesforce, you can copy the field values over to another Salesforce field and use those in your Flow instead.
Hey Jenna! Thank you so much for this wonderful article, it has been a huge lifesaver in trying to implement this. I would like to touch upon Adam’s point and your response to it. You mentioned setting the Pardot fields to use Salesforce as the master, which I think would work if the Salesforce field had a value in it, but since the flow wipes it each time, the Pardot value keeps syncing into the SFDC field. So I am guessing in order for this to actually work correctly you would need to contact Pardot Support and have them turn on the feature in the Pardot instance to treat empty/null values as a valid field value, correct?
Hi Adam, I’ve updated the post to include the newest Salesforce Flow features which means you no longer have to clear out the field values for this to work. Check it out!
Is it possible to use this approach to capture multiple UTM touchpoints from Pardot assets?
Hi Lisa, Yes, it is. You would need to map your Pardot UTM fields to fields in Salesforce.
Hello,
We have set all of this up but I am still confused on where will Salesforce get the UTM data from?
Is there a Google Analytics integration we need to set up before launching the Flow in Salesforce?
Thank you,
Niya
Hi Niya, It depends on how you are capturing leads. Most people add hidden fields to their lead forms which would populate the UTM data within their marketing automation system and then the information would be synced with Salesforce.
Great article Jenna and it couldn’t be any better timing for what I’m working on at the moment. Thank you!
Two follow up questions I have:
– Do you have any articles that show how to incorporate these touch points into attribution modeling in Marketo, Salesforce, or a tool linked to either one of these platforms?
– If these 3 UTM fields are being set from Marketo then is there a way to handle a lead being part of multiple campaigns in between syncs? As I understand it, if there is more than 1 campaign interaction only the last campaign’s parameters will be synced to SFDC and a record created. Would the custom UTM object have to brought into Marketo to cater for this?
Hi Tyron, Thank you! To answer your questions…
1. No, I don’t have any articles on this.. yet. Seems like a great idea for a follow-up post!
2. If your Marketo fields are set up to overwrite the field values for the UTMs, you shouldn’t have to worry about having multiple campaigns running. As soon as those field values are updated, this should trigger the Marketo -> Salesforce sync and the Salesforce Flow will run and populate the custom object.
Got it thanks for the reply Jenna!