I recently wrote an article for The Silicon Prairie News about the importance of lead source attribution: the ability to match every dollar of revenue earned to dollars spent on paid advertising and time spent on organic traffic.

To achieve the ability to track the source of leads starting with traffic on a website all the way to paid customers on a relatively inexpensive budget, I like to use a combination of UTM Codes, Mixpanel, and a CRM (Infusionsoft, HubSpot, Salesforce, etc.).

Here is a technical guide to accomplishing our setup.


UTM Codes

A UTM Code is a common way to track lead sources by medium, source, campaign and content that’s widely recognized by analytics platforms like Google Analytics. Rather than reinvent the wheel, I recommend fitting this system to your business in order to preserve cross-compatibility between analytics platforms.

To use the system, simply append the UTM Parameters to your URLs like the following:


You can enter whatever variable you want for each parameter, but it’s important to keep some sort of order.


Medium – This the broadest parameter which describes the source in the most general terms such as SocialMedia, PaidSocial, PaidSearch, Referral, etc.

Source – The source is more specific than medium, for example: Twitter, Facebook, LinkedIn, etc.

Campaign – Even more specific than source is your campaign. You might use something like GuestBlogging, PromotionalContest, FreeGiveaway, etc.

Content – Content is an optional parameter that you can use to differentiate ads within campaigns. This works well for A/B testing.


UTM Builder Tools

To easily create UTM codes, you can use Google’s URL Builder in a pinch; but I would recommend that your team use a system that can store all the codes your organization uses so that you stay on the same page. Something as simple as a different spelling can create different source in your analytics software.

We created a tool in Google Sheets that stores each variable for future use and provides drop-down fields to easily assemble your URL. Here’s a screen-shot:

Screen Shot 2016-06-28 at 8.10.53 AM

You can get access to this sheet to copy for yourself here.


Use UTM Codes Everywhere

Once you’ve got a system to store and create your UTM Code-enhanced links, it’s important to replace just about every link you can think of. Here are some common places where marketing links are found:

  • Social Media Posts
  • Social Media Bios
  • Paid Ads
  • Email Signatures
  • Links in Email Blasts
  • Links from Affiliate Websites
  • Guest Blog Posts
  • Forums & Discussion Boards


Google Analytics

If you use Google Analytics, once you have your links in place, your data will start to accumulate. Access the information at analytics.google.com by selecting acquisition/campaigns.



We like Mixpanel because it provides some additional features like cookie tracking to gather user behavior data as they return to your site over time.

Mixpanel takes a bit of technical knowledge to set up, but allows you flexibility in setting up your system.

Here’s the overview of how the setup works:

  1. Mixpanel puts a cookie on the user’s device & creates a Profile
  2. Some Javascript parses the UTM codes from the URL
  3. Those codes are passed along to Mixpanel as two types of “Super Properties”
  4. Each parameter creates a “1st Touch” and “Last Touch” Super Property
  5. The 1st Touch Super Properties are only updated once, while last touch is always updated to the most recent data




Wherever we have forms to collect data from our users, we pull the UTM data for 1st and last touch attribution into our form. Here’s a guide:

  1. Set up 2 custom fields in your CRM for each UTM Code, for example UTM_Medium_1st_Touch and UTM_Medium_Last_Touch
  2. Set the 1st touch fields to never update and the last touch fields to always update to the latest information
  3. Use javascript to pull the UTM data from the MixPanel cookie
  4. Add the data to hidden fields in your input form


Reporting Metrics

Once you’ve completed the steps above, you should have the ability to accomplish some pretty detailed reporting. Start with simple return on investment calculations by comparing revenue by source to advertising spend per source.

Next, calculate your cost per conversion at each funnel stage by dividing your ad spend by the number of conversions at each stage.

This should give you a sound foundation to know where your revenue is coming from and which advertising sources to crank up or shut off.