How To Add UTM And Referrer Information To Lead Forms?

Every lead is valuable for at least two reasons:

  1. For being a lead that moves your business
  2. Identifying your most valuable channels

In marketing, leads are any potential customers that are interested in a company’s product or services. By sharing their personal contact information, the company can contact them regarding their interests. Leads are important to companies because it allows them to develop strategies to intrigue customers.

So how can you find out where a lead came from?

One way is to have them answer “How did you find us?”. But many people either don’t answer or forget where they found your website.

You can also get this information by configuring goals/conversions in your favorite analytics tool, let’s say Google Analytics. Your reports will tell you where the most conversions came from.

However, there’s one drawback to this approach. You get this information in aggregate and can’t look at a specific subscriber to tell where they came from.

Let’s discuss a simple technique to capture UTM and Referrer information along with your lead generation forms. I covered a basic version of this in another post. The technique discussed here is simpler and more powerful than the old one.

I might be duplicating some parts from the old post, but it’s better to have everything in one place.

Let’s get started!

1. Configure Your CRM Or Email Service Provider

Since you’ll be collecting extra information about your leads/subscribers, you need to tell your CRM or email service provider to accept the new fields. Here I’m using MailChimp as an example:

Mailchimp UTM and Referrer Fields
MailChimp UTM and Referrer Fields

How do you do this for Mailchimp?

  1. Go to your subscribers list. Select List fields and *|MERGE|* tags from Settings.
  2. Click Add A Field, select text. Add “UTM_SOURCE” for Field Label and “USOURCE” for Put this tag in your content.
  3. Make sure Required? and Visible? are unchecked.
  4. Repeat the same for each of the remaining UTM parameters. i.e. UMEDIUM, UCAMPAIGN, UCONTENT, UTERM
  5. Also repeat it for IREFERRER, LREFERRER, ILANDPAGE, and VISITS as shown in the above image.
  6. Click Save Changes.

2. Add UTM Form Script To Your Website

Just add this before the closing </body> tag at the bottom of every page on your website.

<script src="https://www.terminusapp.com/resources/utm_form-1.1.0.min.js" async></script>

It’s that simple. You could either make a change directly to your website or use Google Tag Manager for this.

NOTE: The script will be loaded from Terminus CDN and I’ll pick up the tab for your traffic. However, I don’t provide any guarantee that this will always be available. To be safe, you could host it yourself.

3. See UTM And Referrer Information For Each Subscriber

So what information will you be able to capture your leads/subscribers?

  • 5 UTM parameters – Any UTM parameters in the URL that a visitor used to come to your website will be added to the form
  • Initial Referrer – The webpage where the visitor came from for the first time
  • Last Referrer – The webpage where the visitor came from most recently
  • Initial Landing page – URL of the page on your website where the visitor landed the very first time
  • Number of visits – The number of times a visitor came to your website before filling your form

All of this information is saved in a cookie so it doesn’t matter if a visitor navigates to different pages on your website before filling your form. This information is added to the lead form in all cases.

How Does A Subscriber Look Like In Mailchimp?

Subscriber with UTM and Referrer information
Subscriber with UTM and Referrer information

As you can see, this subscriber initially came to Terminus from Google (Initial Referrer) and then later from Quora by clicking on a UTM tagged URL. I also know the exact question (Last Referrer) they saw on Quora and that the visitor converted on their second visit (Visits). Additionally, I know they initially landed on a blog post (Landing Page) on Terminus.

So how did this end up happening?

The visitor was probably searching for some UTM related information on Google and landed on Terminus. Then they then went to Quora looking for similar information. Again, they found that Terminus was mentioned there, came back to Terminus blog and converted. Now I know that the combination of SEO and answering Quora questions is working without getting lost in multi-attribution reports.

I’m sure you can use this information in various innovative ways and get some unique insights about your leads.

Since this information is attached to each lead/subscriber, you can move it between different CRMs or email service providers. It’s not tied to any analytics tool. You can also export it to any spreadsheet and analyze it.

NOTE: If you want to take your UTM tracking to the next level, sign up for our FREE email course:  Learn the Best Practices for Building UTM Tracking URLs.

What If I Have Some Advanced Needs?

You may want to change the default values of the UTM Form script if your setup is a bit complex. You can easily configure it for the most common cases.

1. Track Visitors Across All Subdomains

If you have more than one subdomain and you want to track the visitor information across all of them, you can change the code as follows:

<script type="text/javascript" charset="utf-8">
  var _uf = _uf || {};
  _uf.domain = ".example.com";
  </script>

<script src="https://www.terminusapp.com/resources/utm_form-1.1.0.min.js" async></script>

Change example.com to your domain name.

2. Change The Fields Names

If you don’t like the default form field values (i.e. USOURCE, UCAMPAIGN, IREFERRER, etc.), you can specify them as well. Besides these, there are a bunch of other configuration options that can help with your particular needs as well.

<script type="text/javascript" charset="utf-8">
 var _uf = _uf || {};
 _uf.domain = ".example.com";

 _uf.utm_source_field = "YOUR_SOURCE_FIELD"; // Default 'USOURCE'
 _uf.utm_medium_field = "YOUR_MEDIUM_FIELD"; // Default 'UMEDIUM'
 _uf.utm_campaign_field = "YOUR_CAMPAIGN_FIELD"; // Default 'UCAMPAIGN'
 _uf.utm_content_field = "YOUR_CONTENT_FIELD"; // Default 'UCONTENT'
 _uf.utm_term_field = "YOUR_TERM_FIELD"; // Default 'UTERM'

 _uf.initial_referrer_field = "YOUR_INITIAL_REFERRER_FIELD"; // Default 'IREFERRER'
 _uf.last_referrer_field = "YOUR_LAST_REFERRER_FIELD"; // Default 'LREFERRER'
 _uf.initial_landing_page_field = "YOUR_INITIAL_LANDING_PAGE_FIELD"; // Default 'ILANDPAGE'
 _uf.visits_field = "YOUR_VISITS_FIELD"; // Default 'VISITS'
 _uf.additional_params_map = {
 affiliate: "AFFILIATE"
 }; // Maps affiliate parameter to AFFILIATE form field
 _uf.sessionLength = 2; // In hours. Default is 1 hour
 _uf.add_to_form = "first"; // 'none', 'all', 'first'. Default is 'all'
 _uf.form_query_selector = 'form[action="/sign_up"]'; // custom form selector. Default is 'form', to select any form.
 _uf.decode_uris = true; // Decode URLs before populating the form. e.g. use "https://" instead of "https%3A//".
                         // NOTE: This will decode the entire URL and, in rare cases, may have side effects.
</script>  
<script src="https://www.terminusapp.com/resources/utm_form-1.1.0.min.js" async></script>

3. Super Customization

Do you want to look at the code and play with it? Awesome. The code is open-sourced on Github. It also has some more detailed information about what happens when you add this script.

If you think you can improve it, just send a pull request and I’ll be happy to merge it if looks good.

What Now?

You can now capture a lot of valuable information about your visitors, especially where they are coming from. Get the power of expensive analytics tools without the expensive part.

Sometimes looking at each person individually gives you a much better feel about them, what they are looking for, how they found your site, etc. It’s much better than treating them as a point on your chart.

Bonus: How To Build And Manage UTM URLs?

Capturing UTM parameters in your lead forms is only one small part of your tracking.

Building and managing your UTM URLs is a whole other ball game. If you are serious about your UTM strategy, you need good tools for yourself and your team.

I’m biased, but Terminus UTM URL Builder is built for robust UTM tracking. Helping you make your UTM conventions part of your URL builder is just one such feature.

UTM Naming Conventions

If you haven’t already, signup for a free 21-day trial and see it for yourself. There are zero risks because you can cancel anytime!