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 Sponge’s 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 Sponge 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 Sponge to do this for you?  Just get in touch ⬇️


Want tips, tutorials, best practices, and other cool stuff delivered to your inbox?  Subscribe to the quarterly Sponge newsletter >

Sponge | 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

Sponge | Marketing and Revenue Ops

Download Resource

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