XEN Digital Marketing and HubSpot Blog

Tracking utm parameters in HubSpot forms

Written by Craig Bailey | 19 October 2015 7:12:21 AM

I had an interesting question from a client about the option to track utm_ parameters from URLs into HubSpot, capturing them via HubSpot forms.

They had a promotion campaign in place and a landing page was being promoted via an industry site. The industry site had set the URL to use a bunch of their own utm parameters, and my client wanted to be able to view signups that had come from that particular site.

In this case my client wanted to be able to capture the utm parameters and view them on each individual contact.

What are utm parameters?

utm_ parameters are the extra bits that are added to a URL to include source and campaign data. Here's an example of a URL with utm parameters in green:

https://xen.com.au/5-key-inbound-marketing-considerations-for-marketing-managers/?utm_campaign=blog&utm_content=22165787&utm_medium=social&utm_source=twitter

In this example there are 4 utm parameters in place: utm_campaign, utm_source, utm_medium and utm_content.

For a fuller description of how utm parameters are used, Google's URL builder page has some good examples.

For building your own URLs with utm tracking parameters, HubSpots tracking URLs builder is an easy way to organise and generate them (look for it from your HubSpot Reports section).

Capturing URL parameters

HubSpot already captures URL utm_ parameter details behind the scenes, however these aren't viewable on the individual contact details. Instead they are used in reports for consolidating the details. You can drill down into Campaign results via Sources reports to see the list of contacts that came via a particular campaign, but there's no way to select the contacts from Contact search. Nor any way to see the utm parameters on the individual contact profiles.**

In order to view them on individual contacts, we need to set up a process to capture them. The following sections detail a way to set this up (but note the caveats section at the end).

There's two main steps for setting up HubSpot to track the utm parameters:

  1. Add contact custom properties
  2. Add the contact custom properties as hidden fields on your form(s)

BTW this process will work with any parameters in URLs (ie not just utm_ parameters) but for the sake of this post, we are just discussing utm_ examples (see also this HubSpot KB article).

1. Adding utm parameter custom properties

The first thing to do is add custom properties for each utm parameter you want to track.

From Contact settings, start by adding a new property, using the exact name of the utm parameter in the label:

Note: I had already created a new Group called XEN Hidden, just for grouping together all my hidden field properties.

Do this for each of the utm parameters. The naming is important - the custom property label must exactly match the utm parameter you wish to track.

Use Single-line text field as the Field type, and make sure they are available for use in forms.

After adding them all you'll have a group of them like so:

You can edit any of them if required:

BTW, later after the field has been used in forms you can click on the Analytics tab to give you an overview of how many contacts have this property filled:

2. Adding utm parameter fields to forms

The next step is to add the new custom fields to your form(s).

Add the fields to your form, and set them to be hidden:

The label should match the utm parameter that is to be tracked.

Here's how a form looks with all 5 of my utm parameter custom contact properties added as hidden fields:

Make sure the fields are optional (ie don't set them to be required), and don't set them to be smart (ie we always want them to be rendered in a form).

And you're done. Save the form and the next time it is used, the form will look for the utm parameters in the URL and insert them into the hidden fields.

Viewing utm parameter fields on contacts

Now that the new custom fields are being set to track, you can add them to contact listing and profile layouts.

These fields can be added to contact listing columns and summary field layouts:

One advantage of having the fields on the contact summary field list is you can easily hover over the history 'clock' icon to their right to see a full log of their history:

Caveats

There's a few things to note with this tracking:

  • the utm parameters will get overwritten by later form submits ie if a visitor returns later (via another URL with different utm parameters) the utm custom properties will be overridden with the latest
  • but you can always check the custom field history to see the log of changes

References