How To Use UTM Parameters to Capture Lead Source in Pardot

In:

You might already be using UTM parameters to track your marketing campaigns with Google Analytics, but are you capturing that information when a prospect is created in Pardot? Capturing this data is critical in order to assess the value of your marketing campaign and is a lead management best practice.

What are UTM Parameters?

UTM parameters are tags you add to a URL. Marketers use this to be able to track the traffic from a variety of sources such as email, social media, banner ads, etc. The tags can be sent back to Google Analytics and tracked which can be used to gauge the effectiveness of campaigns and identify the best ways to drive more visitors to your website.

hidden-fields-in-forms-3

Create New Fields

The first thing you need to do is create 2 new fields in Salesforce and in Pardot and map them. You don’t need to create a field for utm_source, we will use the standard source field in Pardot.

  1. utm_medium
  2. utm_campaign

hidden-fields-in-forms-2

Add The New Fields to Your Pardot Forms

Next, add the fields to your Pardot form. All 3 fields should be hidden and not marked as required.

Add Some Code to Your Landing Page Templates

This piece of code will parse the URL parameters and put the values into the hidden fields within your form. This code can be placed within your landing page template or within your form in the below form section.

Note: If you don’t use the field names outlined in this tutorial, you might need to update the JavaScript to include the correct field names.

Create URLs and Test

Now you’re ready to start creating URLs and testing your form. Use this handy URL builder to create your links and then fill out the form to see if the values go into Pardot.

Questions?

Send them to me via email, send me a tweet @jennamolby, or leave a comment

Related Posts

  • 17/06/2019
    How to Integrate Gravity Forms With Pardot

    Gravity Forms is one of the easiest tools to create advanced forms for your Wordpress website and with some customization they can be integrated with Pardot. In this post, I will show you how to integrate Gravity Forms using Pardot Form Handlers.

  • 28/02/2019
    Creative Ways to Spice Up Your Pardot Forms: Part 1

    Looking for some creative ways to spice up your Pardot forms? In this post, I will show you how to implement the popular floating label technique in three easy steps. I will also show you how to turn your long drop down menus into user-friendly, searchable dropdowns.

  • 05/02/2019
    How to Customize your Pardot Email Preference Page

    In this tutorial, I will show you how to turn the default Pardot email preference page into a preference page that matches your brand. You will learn how to customize everything including the header, footer, form, and text.

39 comment(s)
  • Brijendra Singh

    18/09/2018 at 10:42 am
    Reply

    Hi Jenna, Is there any way we can append the UTM parameters in the links that we use in emails? I wanted all my email links starting with "www" to have the UTM parameters automatically. This can be done in Responsys & in Eloqua. But couldn't find a way to do for emails in Pardot. Thanks!

    • Jenna Molby
      to Brijendra Singh

      18/09/2018 at 12:55 pm
      Reply

      No, I haven't come across a way to do that in Pardot.

    • Rhonda Hernandez
      to Jenna Molby

      15/11/2018 at 6:40 am
      Reply

      Hey Jenna, your code works wonderfully and pulls the info into the prospects record thank you so much for your detailed instructions.. However I am having trouble with the encoding of the UTM link that is attached to a button in my html email. What special characters do I have to change out to get the link to correctly update the "Click to open ratio in my email stats?

    • Jenna Molby
      to Rhonda Hernandez

      15/11/2018 at 8:43 am
      Reply

      Hi Rhonda, So happy it worked for you. Here's a link to some detailed documentation on how to encode special characters within Pardot email links: https://help.salesforce.com/articleView?id=pardot_url_encoding_emails.htm&type=0. Cheers, Jenna

  • Keenan

    04/09/2018 at 5:37 pm
    Reply

    Hi Jenna, thanks for all your content. I've followed your content for Marketo tips in the past and again now as I'm onboarding Pardot for my org. I'm having trouble getting your code to work. I've tried it both within my page and through the 'below form' section with the code input section. I modified the code to include utm_content and term, and renamed the fields according to my Pardot API field names. The custom fields are type = hidden, the sync behavior is to use Pardot's value, No matter where I've implemented the code, I haven't seen any values passed. If there is a lead with pre-existing data, the last touch fields are submitted as blank (and then subsequently switched back by the SFDC sync). If the lead has no pre-existing data, then nothing is registered. My code is below -- Any ideas why the values aren't being passed? Thank you again! // Parse the URL function getParameterByName(name) { name = name.replace(/[[]/, "\[").replace(/[]]/, "\]"); var regex = new RegExp("[\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/+/g, " ")); } // Give the URL parameters variable names var source = getParameterByName('utm_source'); var medium = getParameterByName('utm_medium'); var campaign = getParameterByName('utm_campaign'); var content = getParameterByName('utm_content'); var term = getParameterByName('utm_term'); // Put the variable names into the hidden fields in the form. selector should be "p.YOURFIELDNAME input" document.querySelector("p.Lead_Source_Name__Last_Touch_ input").value = source; document.querySelector("p.Lead_Source_Last_Touch input").value = medium; document.querySelector("p.Lead_Campaign__Last_Touch_ input").value = campaign; document.querySelector("p.Lead_Campaign_Content__Last_Touch_ input").value = content; document.querySelector("p.Lead_Campaign_Term__Last_Touch_ input").value = term;

    • Jenna Molby
      to Keenan

      05/09/2018 at 9:16 am
      Reply

      Hi Keenan, Your code looks good to me. Can you email the link to the landing page to [email protected]? Thanks, Jenna

  • Lou

    03/08/2018 at 1:45 pm
    Reply

    Hi Jenna, would it be possible to do this to the form handler as well? Thanks!

    • Jenna Molby
      to Lou

      03/08/2018 at 3:43 pm
      Reply

      Hi Lou, Yes, It's possible. You would need to add the hidden fields to your form handler and add the javascript to your page. You might need to make some adjustments to the javascript to match the selectors you define within your form handler code. Cheers, Jenna

    • Jaime
      to Jenna Molby

      11/12/2018 at 6:34 am
      Reply

      Hi Jenna, thank you for this tutorial. I am having a little trouble using this with a Form Handler and wondering if you could easily spot my error: <script type="text/javascript"> // Parse the URL function getParameterByName(name) { name = name.replace(/[[]/, "\[").replace(/[]]/, "\]"); var regex = new RegExp("[\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/+/g, " ")); } // Give the URL parameters variable names var source = getParameterByName('utm_source'); var medium = getParameterByName('utm_medium'); var campaign = getParameterByName('utm_campaign'); var term = getParameterByName('utm_term'); var content = getParameterByName('utm_content'); // Put the variable names into the hidden fields in the form document.querySelector("input[name='convertingsource']").value = source; document.querySelector("input[name='convertingmedium']").value = medium; document.querySelector("input[name='convertingcampaign']").value = campaign; document.querySelector("input[name='convertingterm']").value = term; document.querySelector("input[name='convertingcontent']").value = content; </script> The Form: <form action="http://go.cloudshare.com/l/533752/2018-11-07/4qwvd" method="post" class="html-form"> <div class="field-wrap required"> <label>First Name</label> <input type="text" name="firstname" required="required" /> </div> <div class="field-wrap required"> <label>Last Name</label> <input type="text" name="lastname" required="required" /> </div> <div class="field-wrap required"> <label>Company</label> <input type="text" name="company" required="required" /> </div> <div class="field-wrap required"> <label>Business Email</label> <input type="email" name="email" required="required" /> </div> <div class="field-wrap required"> <label>Phone Number</label> <input type="text" name="phone" required="required" /> </div> <div class="field-wrap"> <label>How Can We Help You Today?</label> <textarea></textarea> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingtimestamp" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingsource" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingmedium" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingcontent" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingcampaign" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingterm" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertinglandingpage" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originaltimestamp" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalsource" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalmedium" /> </div> […] Read MoreHi Jenna, thank you for this tutorial. I am having a little trouble using this with a Form Handler and wondering if you could easily spot my error: <script type="text/javascript"> // Parse the URL function getParameterByName(name) { name = name.replace(/[[]/, "\[").replace(/[]]/, "\]"); var regex = new RegExp("[\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/+/g, " ")); } // Give the URL parameters variable names var source = getParameterByName('utm_source'); var medium = getParameterByName('utm_medium'); var campaign = getParameterByName('utm_campaign'); var term = getParameterByName('utm_term'); var content = getParameterByName('utm_content'); // Put the variable names into the hidden fields in the form document.querySelector("input[name='convertingsource']").value = source; document.querySelector("input[name='convertingmedium']").value = medium; document.querySelector("input[name='convertingcampaign']").value = campaign; document.querySelector("input[name='convertingterm']").value = term; document.querySelector("input[name='convertingcontent']").value = content; </script> The Form: <form action="http://go.cloudshare.com/l/533752/2018-11-07/4qwvd" method="post" class="html-form"> <div class="field-wrap required"> <label>First Name</label> <input type="text" name="firstname" required="required" /> </div> <div class="field-wrap required"> <label>Last Name</label> <input type="text" name="lastname" required="required" /> </div> <div class="field-wrap required"> <label>Company</label> <input type="text" name="company" required="required" /> </div> <div class="field-wrap required"> <label>Business Email</label> <input type="email" name="email" required="required" /> </div> <div class="field-wrap required"> <label>Phone Number</label> <input type="text" name="phone" required="required" /> </div> <div class="field-wrap"> <label>How Can We Help You Today?</label> <textarea></textarea> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingtimestamp" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingsource" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingmedium" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingcontent" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingcampaign" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertingterm" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="convertinglandingpage" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originaltimestamp" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalsource" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalmedium" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalcontent" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalcampaign" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originalterm" /> </div> <div class="field-wrap hidden"> <input type="hidden" name="originallandingpage" /> </div> <div class="submit-wrap"> <input type="submit" value="Talk to us" required="required" /> </div> </form> Read Less

    • Jenna Molby
      to Jaime

      12/12/2018 at 9:34 am
      Reply

      Hi Jaime, This code looks good to me. If you're still experiencing issues email me at [email protected] with a link to your landing page and I can help troubleshoot. Cheers, Jenna

  • Sean

    02/08/2018 at 11:48 am
    Reply

    Hi Jenna, If I add the code to the below form section in Pardot, how can i keep that text hidden on my form? When i click "view online" i can see the html below my form. Thanks!

    • Jenna Molby
      to Sean

      02/08/2018 at 1:16 pm
      Reply

      Hi Sean, Make sure you wrap the JavaScript in script tags. I've updated the example to include this. Cheers, Jenna

  • Andy

    26/07/2018 at 5:51 am
    Reply

    Do you also leverage the Google Analytics connector to pull in this information, or do it only through the hidden form fields?

    • Jenna Molby
      to Andy

      26/07/2018 at 12:58 pm
      Reply

      Hi Andy, you can use both! The Google Analytics connector only captures the UTMs once, so you could use that for the first touch and this method for the last touch. Cheers, Jenna

    • Dave
      to Jenna Molby

      30/08/2018 at 8:56 am
      Reply

      Hi Jenna. When you say that the GA connector only captures the UTMs once, when is that exactly? The first time they are written to the database? The create date?

1 2 3 5

Leave A Comment

Your email address will not be published. Required fields are marked *

About Me

Welcome to my blog, where I share, tips, tricks, thoughts and solutions that I learn in my daily life as a sales and marketing professional.

LEARN MORE

Categories
Most Commented
Popular Posts