Track UTM Tags

The Mixpanel JavaScript library automatically detects:

  • utm_source
  • utm_medium
  • utm_campaign
  • utm_content
  • utm_term

If they are present in your URL and sets them as Super Properties. Mixpanel only tracks first touch UTM parameters by default. 

What is a utm_ parameter?

UTM stands for Urchin Traffic Manager (Urchin was renamed to Google Analytics after Google bought them, but the utm_ convention stuck), and is a convenient way to tag links to various landing pages on the web. If you are driving traffic to a certain landing page, say you might want to know which of your marketing efforts is most effective at driving total traffic and more importantly at bringing in qualified traffic. For a simple example, let's say you are driving traffic to this page from a Google AdWords Campaign and send an email blast to your existing customers. For the AdWords campaign you would send your users to the following url:

This wouldn't change the content on the page, but Mixpanel would detect that utm_source parameter and register a super property, associating all that customer's events with the proper utm_source. The link in your email campaign you would go to this url:

The utm_source in this case would be email_newsletter. Once you have a traffic flowing to a landing page with a utm_ parameter you can segment by that utm_ parameter. Below is a landing page to sign up funnel segmented by utm_source:

You can see that in this case the traffic from the newsletter, though there is less of it, converts at a slightly better rate!

Advanced Usage

You can combine utm_source, utm_medium, utm_campaign, utm_content into a single URL so you can slice different ways:

  • utm_medium is generally the highest grouping, indicating the overall channel (PPC, E-Mail, etc).
  • utm_source is the next level, answering the question which provider within the channel brought the traffic (AdWords, Bing, E-Mail Newsletter)
  • utm_campaign is the next level down, describing your actual marketing campaign ('Snow Boots') and
  • utm_content can describe variations in the content and message of your campaigns (for example some ads might advertise'Warm Snow Boots' and others might advertise 'Durable Snow Boots'). An URL with a fully baked set of campaign parameters would look like this:

What if a customer comes to my site multiple times from different campaigns?

By default, we use "first touch" attribution for the utm_ parameters. As long as your customer doesn't clear their cookies or come from a different device, Mixpanel will remember the original utm_source. If you'd like an example of how to track last touch attribution, refer to this Community Tip.

What if I have my own campaign parameter, like cid?

If you use a non-standard campaign parameter, Mixpanel support can help you write the appropriate JavaScript to pull it from the URL and register it as a super property.

Further Resources

Is this article helpful?
10 out of 15 found this helpful



Article is closed for comments.