Playbook How (and Why) to Stamp UTMs on Campaign Member Records in Salesforce

This playbook is designed to be a step-by-step guide on how to stamp UTM parameters on to the Camapign Member record in Salesforce. Note that this is one way of doing this task, but there are multiple ways to accomplish this outcome.

Why stamp UTM parameters on the Campaign Member record?

A common practice is to add hidden fields to the forms on your website to collect the standard UTM parameters. These forms are commonly built using your marketing automation platform (HubSpot, Marketo, Pardot, etc), collected at the contact level, and then synced to Salesforce as a Lead or Contact.

There are two main issues caused by simply syncing your UTM parameters to the Lead/Contact in Salesforce:

  • Storing multiple conversions
  • The problem with storing your UTM parameters on Lead/Contact is that there is no good way to store multiple conversion events from the same Lead/Contact. Some companies will store the "first" and "last" UTM parameter values, which is better than storing just the first values or always overwriting the field with the last value, but it still doesn't solve for Leads/Contacts that convert more than two times.

  • Tying the UTM parameters to a specific campaign
  • The other problem with simply capturing the UTM parameter on Lead/Contact is that you lose the context as to which marketing campaign or initiative the UTM parameters are tied to. For example, let's say you run a webinar and you promote it via email, Google ads, LinkedIn ads, and organically on Twitter/X and LinkedIn. You would want to know exactly where each registration for the webinar came from, but simply storing it on Lead/Contact will work for the very first conversion event of a net new Lead/Contact, but future conversion events will be nearly impossible to track properly without stamping the UTM parameters on the Campaign Member record for that specific webinar.

How to stamp UTM parameters on the Campaign Member record

As mentioned above, this is one way to stamp UTM parameters on the Campaign Member record, but you may want to tweak the approach based on your Salesforce environment or maybe you have a more elegant way to solve the problem based on your tech stack.

Our approach is going to be to do the following:

  • Collect UTM parameters in a hidden field in form submissions typically using a marketing automation platform
  • Sync the UTM parameters to fields on Lead/Contact in Salesforce
  • Add the Lead/Contact into a Salesforce Campaign and, using a Salesforce Flow, "stamp" the current UTM values on Lead/Contact onto the Campaign Member record

Note that this playbook is really going to focus on #3 above.

Step #1: Create UTM fields on Lead

Follow the following steps in Salesforce:

  • Go to Setup -> Object Manager -> Lead -> Fields & Relationships
  • Create the following 5 fields of type Text(255):
    • utm_campaign
    • utm_medium
    • utm_source
    • utm_term
    • utm_content

Step #2: Create UTM fields on Contact

  • Go to Setup -> Object Manager -> Contact -> Fields & Relationships
  • Create the following 5 fields of type Text(255):
    • utm_campaign
    • utm_medium
    • utm_source
    • utm_term
    • utm_content

Step #3: Map Lead Fields for the newly created UTM fields on Lead and Contact

  • Go to Setup -> Object Manager -> Lead -> Fields & Relationships
  • Click the "Map Lead Fields" button (top right)
  • Click the "Contact" tab
  • Select the corresponding Contact field for each UTM field
  • Click "Save"

Step #4: Create UTM fields on Campaign Member

  • Go to Setup -> Object Manager -> Campaign Member -> Fields & Relationships
  • Create the following 5 fields of type Text(255):
    • utm_campaign
    • utm_medium
    • utm_source
    • utm_term
    • utm_content

Step #5: Create a Salesforce Flow to "stamp" the UTM value on Campaign Member

  • Go to Setup -> Flows
  • Click "New Flow"
  • Select "Record-Triggered Flow" -> Create
  • Use the following settings for the start criteria:
  • In the flow, click "Add Element" and select "Update Triggering Record"
  • Use the following settings for the "Update Records" step:
  • For each corresponding "Value" field for each UTM field, we need to create a new resource that is a formula field that gets the UTM value from the Lead or Contact. Follow these steps:
    • Click into the "Value" textbox
    • Click "New Resource"
    • Select "Formula" as the Resource Type
    • Use the following settings for the "New Resource":
    • You can copy-and-paste from below (just be sure to update the "utm_campaign__c" portion based on the field):
    • Repeat for each of the remaining UTM field values.
  • Click Save and give the flow a name and description
  • Click "Activate" to turn on the flow

Step #6: Clear the UTM field on Lead/Contact

As a final step, we recommend clearing the UTM fields on Lead/Contact after a set period of time. We personally like to use 24 hours. This is typically best accomplished using your marketing automation platform, but you can also do it in a scheduled flow.

That's it! You're done. This strategy combined with Align.ly Attribution is a winning combination to know exactly which campaigns, channels, content, and keywords are performing.

Ready to take the next step? Request a demo today.

We will follow-up with you shortly to schedule a day/time that works for you and your team.

Request a Demo