Newer post available

Hi there, you are viewing an old post that is a bit outdated. Click here to view the post with the latest instructions.

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

Author

I'm a Freelance Marketing Operations Consultant With 15 years of experience in Marketing Operations, I’ve worked with a wide range of tools including Salesforce, Marketing Cloud Account Engagement (Pardot), Marketo, and many other sales and marketing platforms. I help teams optimize their tech stacks, improve processes, and get accurate, actionable reporting. Whether it’s setting up your Marketing Automation Platform, building Salesforce reports, managing lead lifecycles, tracking attribution, or integrating your tech stack, I ensure everything is aligned to drive real results.

57 Comments

  1. Brijendra Singh 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

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

    • Rhonda Hernandez

      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?

  2. 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!

    • Jenna Molby

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

    • Jenna Molby

      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

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

    • Jenna Molby

      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

  3. 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

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

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

    • Jenna Molby

      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

    • 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?

Write A Comment