Marketers / Marketing Ops

How to Capture UTM Parameters in Salesforce

By Aaron Beashel

Do you know which marketing campaigns and channels are generating the majority of your leads, opportunities, and customers? What about how certain channels compare in terms of average deal size, time to close, and revenue generated?

If you don’t have the tools to answer these questions, then you could be wasting your marketing budget on campaigns that drive visits to your website but don’t convert into customers. Fortunately, there is a solution.

By capturing UTM parameters and other marketing attribution data and sending it into Salesforce, you can run reports that show you exactly what channels and campaigns are generating customers & revenue. In this article, I will explain why you need to capture UTM parameters, how to do this, as well as giving you example reports so you can see how your system could be…

Why You Need to Capture UTM Parameters in Salesforce

When you have analytics tools like Google Analytics installed on your website, you can easily see what channels and campaigns are generating website visitors.

But if you’re the kind of business that sells its product or service through a sales team then tracking website visitors isn’t enough. In fact, it may even be causing you to make the wrong decisions about how to grow your business.

To illustrate, imagine the table below shows the results from your Facebook & Google Ad campaigns:

Facebook AdsGoogle Ads

If this was all the data you had, you would think your Facebook Ads are performing better – you’re getting 2x the amount of visitors for the same budget.

However, if you were tagging all your campaigns with UTM parameters and capturing those in Salesforce, you’d be able to see the result of each channel all the way through the funnel to customers and revenue. It would probably look something like this:

Facebook AdsGoogle Ads

As you can see from the table above, Google Ads is actually far better because:

  • You got more customers.
  • Your conversion rate from lead to customer is five times higher.
  • Your average customer value is higher (Google Ads is $5,000, Facebook Ads is $4,000).
  • Your cost of acquiring a customer is lower (Google Ads is $200, Facebook Ads is $1,000).
  • Your Return on Ad Spend (ROAS) is three times higher.

This is more common than you think as well. Facebook Ads and other display channels are notorious for driving high amounts of visitors that don’t convert. Visitors from Google Ads often convert much better due to the fact they have likely searched for something related to your product and have some level of purchase intent.

3 Ways to Capture UTM Parameters in Salesforce

Now that you understand the importance of capturing UTM parameters in Salesforce, let’s look at 3 different ways to do it:

Method 1: Use the Built-In Features of Form-Building Tools

If you’re using a dedicated form-building tool to power the forms on your website, such as Gravity Forms or Jotform, then these tools usually have a built-in way to capture UTM parameters.

In most cases, you simply need to add a series of hidden fields to the bottom of your forms with specific names – usually utm_source, utm_campaign, etc – and then turn on the form builders ‘prefilling’ feature.

With this done, your forms will then look for any UTM parameters in the URL of the page and automatically pull them into the hidden fields in the form. Then when the form is submitted, the UTM’s are captured and sent to Salesforce alongside the information the lead entered into your form (I.e. their name, email, company, etc).


  • Cost: In most cases, if you’re already using (and paying for) the form tool then adding this on will cost you nothing. It’s a pretty basic feature and is usually available on all plans. 


  • Only captures UTM parameters: These prefilling features only grab UTM parameters, which means you’ll only get information on leads who come from the paid campaigns you’ve added UTM parameters to. You won’t get any attribution information on leads who come from organic channels like Organic Search, Organic Social, Referral, Direct, etc.
  • Requires the UTM’s to be in the URL: Because this functionality simply pulls the UTM parameter from the URL, it requires the UTM parameter to actually be present on the page where the form is completed. So if you are directing people to a landing page from your ads and then have to click through to another page (i.e. your ‘Contact Us’ page) to fill out a form, the UTM parameters will be lost.
  • Often results in messy data: This functionality of form builders will just pull in whatever UTM parameters it finds in the URL, so unless you are meticulous with your UTM parameters it’s likely you’ll end up with messy data that makes running accurate reports difficult.

Method 2: Use Google Tag Manager + Custom Code

If you currently use Google Tag Manager on your website, it’s possible to leverage Variables to store the UTM parameters a visitor arrives with in a cookie in their browser. Then you can use custom code to grab the data from the cookie and write it into hidden fields in your forms for it to be sent to Salesforce upon form submission.

Here’s a high-level overview of how it works:

  1. Install the Persist Campaign Data tag template into your Google Tag Manager account and configure it to capture the UTM parameters from the URL.
  2. Create a cookie variable in Google Tag Manager to store the data in a cookie.
  3. Add some custom code to your site to grab the data from the cookie and write it into hidden fields in your form.

If you’re not a Google Tag Manager expert and this all sounds a bit difficult to you, then this article provides step-by-step instructions on how to implement this and even includes the custom code you’ll need for step 3.


  • Cost: Google Tag Manager is free to use on your website.


  • Requires developers and/or marketing operations pros to set up: This method requires a strong knowledge of Google Tag Manager as well as the ability to edit code, so it’s best for those with access to technical resources.
  • Only captures UTM parameters: This method is designed solely to capture UTM parameters from the URL, which means you’ll only get information on leads who come from your paid campaigns and won’t get any attribution data on leads who come from organic channels.

Method 3: Use a Dedicated UTM Capturing Tool

Tools, such as, are purpose-built to capture UTM parameters and send them through to your CRM with each new lead you get from your website.

Once you place the code on your website, it figures out where your visitors are coming from (by looking at things like the UTM parameters in the URL or the referring domain), categorizes visitors into a series of channels (such as Paid Search, Paid Social, Email marketing, Display, etc.), and then stores the data in a cookie in the user’s browser.

Then, when a visitor completes a lead form on your website, the tool writes the UTM parameters and other marketing attribution information into a series of hidden fields you add to your form, and the attribution is passed into Salesforce alongside the lead’s details. It works with Salesforce’s Web-to-Lead forms as well as hundreds of other third-party form building tools.

And once the UTM parameters and other attribution information is in your CRM, you can use it to run reports that show how many leads, opportunities, customers, and revenue each channel and/or campaign is driving.


  • Captures other attribution information: Purpose-built tools not only capture UTM parameters, but they also pass information on leads who arrive on your site through channels where UTM parameters aren’t present (i.e. Organic Search, Organic Social, Referral, Direct, etc). This means you know where every customer comes from, not just the one’s coming from the paid advertising campaigns where you’ve added UTM parameters.
  • Remembers the data: Most other tools and methods for capturing UTM parameters require the UTM parameter to actually be present on the page where the form is completed. This is a problem when the page they complete your form on (i.e. your ‘Contact Us’ page) is not the same page they landed on from your ad (i.e. your homepage or a landing page). UTM capturing tools work differently – they store the UTM parameters in a cookie in the user’s browser, meaning that regardless of what page the user completes a form on the UTM parameters will always be passed through.
  • Cleans the data: If you don’t use a tool like to standardize UTM usage across your team, you could end up with different tags for campaigns, i.e. some of your Facebook Ad campaigns are tagged UTM_Source=Facebook (capitalized), others UTM_Source=facebook (uncapitalized), and also UTM_Source=fb. With the other approaches that just capture raw UTM parameters, these would show up as 3 different sources in your reports and you’d get the wrong information. But purpose-built tools expect these kinds of inconsistencies, and can assign these leads to the correct channel regardless.


  • Cost: If you don’t already have a tool like this in your tech stack, then adding it is going to increase your marketing spend. Plans start from $49 per month.

Example UTM Parameters Reports in Salesforce

After you have decided which option is the best for your business to capture UTM parameters, these are the kind of reports you can run in Salesforce:

Leads by Channel

This report shows how many leads were generated each month, broken down by the channel they came from.

This can be useful to understand at a high-level which channels are actually generating leads (not just visitors) and where you should be investing more to grow. In the example above, it’s clear that Organic Search is a much bigger contributor to leads than Paid Social and has been consistently growing each month, so it may be worth putting more resources there.

Note: This report requires you to capture attribution information on leads coming from non-paid channels like Organic Search and Direct Traffic.

Customers by Source

This report shows only customers who have come from “Paid Social”, and then breaks it down by the network they have come from.

For this example organization, Facebook Ads are driving the majority of their customers from Paid Social and they have seen a steady increase in this over time. Running a report like this can help you focus your strategy within certain channels, such as investing more into Facebook Ads and less into Instagram Ads in this example.

Revenue by Campaign

This report shows how much revenue the organization has generated from each of their Google Ads campaigns.

For this example organization, their brand campaign is driving most of their revenue. The high intent campaign (e.g. bidding on category-related keywords) is still driving substantial revenue along with their competitor and alternative campaigns. This can help you understand at a campaign-level what’s working and what isn’t, and adjust your budget accordingly.


By capturing UTM parameters and other marketing attribution data and sending it into Salesforce, you can run reports that show you exactly what channels and campaigns are generating customers and revenue.

When you’re armed with that information, you’re in a much better position to understand where to invest your marketing resources to increase the number of leads you generate. So try out one of the 3 options above, and start measuring where your leads and customs are coming from today!

The Author

Aaron Beashel

Aaron Beashel is the founder of Attributer. Prior to that, he led marketing teams at B2B SaaS companies like InVision & Campaign Monitor.

Leave a Reply