Salesforce Package: Stamp UTM Parameters on Campaign Members

Most of us are (hopefully!) using UTM parameters to track marketing tactics. You may even be using cookies to capture them more consistently. But once you’ve captured that information on your forms, what do you do with it? Wouldn’t it be great to stamp those UTM parameters on the Campaign Member in Salesforce?  Here’s how to do it, including an unmanaged Salesforce Package that you can just install (you’re welcome!)

>> Related: How to Structure Salesforce Campaigns for Attribution <<

How to stamp UTM parameters on the Campaign Member in Salesforce

  • First, you need fields on the Lead, Contact and Campaign Member to hold the values for your UTM parameters:

UTM Stamping Package Components

Click to expand

  • Once you have that, we use a Flow to stamp new Campaign Members with the UTM values from the Lead or Contact.  The same Flow then nulls UTM field values on the Lead or Contact after we stamp it – so if a person converts again, they can have their new UTM values captured:

flow steps for the salesforce utm package

(BTW if you use Pardot, you’ll need to contact Support about enabling the “Overwrite Pardot values with Salesforce null/empty values” setting in your Account.)

And just like that, you’ve captured all the data on your Campaign Member and it’s dirt simple to pull Salesforce Campaign and Campaign Member reports.  You can slice and dice into UTM dimensions, and you can roll up by medium OR source OR content. #lovetoseeit

Here’s what’s included in the UTM Salesforce Package

I went ahead and just made this an unlocked/unmanaged Salesforce Package because creating all the fields is annoying.  The package contains both the fields and the Flow.

I always recommend starting in sandbox and then moving to production, but you do you:

After installing, the Flow should already be active, but you still need to map the Lead fields to the Contact fields (just in case a Lead gets converted before the Campaign Member has been created).

What if I already have UTM fields in Salesforce?

If you already have UTM fields in Salesforce, you have two options:

  1. If your field API names match (see package components screenshot above), AND there aren’t any other dependencies on those fields, the easiest solution is to simply delete your fields in the sandbox, install the package, and then redeploy to production.
  2. If the field API names do not match, I recommend installing the package in your sandbox and updating the Flow with your own fields.  Just be sure you update all four of the pink steps.

What if I have custom UTM fields?

Sometimes we have custom UTMs like utm_somethingfantastic (or more realistically gclid__c).  If that’s the case, just extend the package and add your custom fields throughout the Flow.  Again, remember to add them to all four (pink) steps, too.

And hey, this isn’t limited to UTMs either. You could use the same framework to stamp any value from the Lead or Contact onto the Campaign Member to get a point-in-time value.

The Fine Print

This Flow is triggered when a new Campaign Member response is created. In other words, it triggers when a new Campaign Member is created and HasResponded is TRUE OR when an existing Campaign Member is updated and HasResponded was previously FALSE, but is now TRUE. If you want to change this behavior, update the entry criteria in the included Flow.

And if you want to do this for you?  Just get in touch!


What are UTM parameters?

UTM parameters, short for “Urchin Tracking Module” parameters, are tags that can be added to the end of a URL to track and analyze the performance of a marketing campaign or link. UTM parameters provide additional information about the source, medium, campaign, and other attributes of a URL, allowing marketers to understand how users interact with their content and campaigns.

What is a field API?

A”Field API” is often associated with Content Management Systems (CMS) and frameworks. One notable example is Drupal, a popular open-source CMS. In Drupal, the Field API is a subsystem that allows developers to define and manage custom data fields for entities (such as nodes, users, and taxonomy terms).

What is the difference between Salesforce Sandbox and Salesforce Production?

Salesforce Sandbox and Salesforce Production are two distinct environments within the Salesforce platform, each serving specific purposes in the development, testing, and deployment lifecycle. | Marketing and Revenue Ops

Get a System Audit

Whether you inherited a new instance or just want a second opinion, we'll dive in and benchmark your tech stack.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden | Marketing and Revenue Ops

Download Resource

Use this form to recieve your free resource in your inbox today!