Inbound Marketing + Sales Blog

October 15, 2015

How to Hack Last-Touch Attribution by Channel into HubSpot

2 min read

Written by: Matthew Buckley  |  Share:


Photo credit Clickz

HubSpot does a lot of things really well. Its analytics can help you understand which website content and blog posts generate the most leads, and what your most-converting first-touch channels. It can even create multi-touch attribution reports that show the last page(s) that a contact viewed before converting. (We've written about these models in-depth here.) However, it doesn't do a good job of providing a last-touch attribution by channel.

This of course may by design, as Avinash Kaushik has warned, "the only use for last click attribution now is to get you fired." This is a bit extreme. Understanding the channel and campaign that provided the last touch can be important, especially when running paid, retargeting and email-nurturing campaigns.

Last touch can become even more important when you consider the complex B2B sale that is often omnichannel and takes place over a longer time period. This is where first and last touch, multi-touch or W-shaped attribution models are most effective. But for any of these to work properly, last-touch must be measured as well.

So, with that in mind, back to the topic at hand! In today's post we're going to discuss how last-touch attribution by channel can be implemented into HubSpot.

Hacking last-touch attribution into HubSpot

To reiterate, this isn't a native solution, so get ready to roll up your sleeves. To do this we're going to use JavaScript and hidden custom properties on your forms.

On the JavaScript side, we'll use the document .referrer property to grab the referring URL and compare it to the current base-domain URL. We then check for UTM parameters on the URL, and if the UTM parameters aren't present, identify what they should be and populate them accordingly.

Next, so that these properties are properly entered into your HubSpot database, you'll need to create all the custom contact properties that you'll be measuring as single-line text fields. That should look like this:


Finally, you'll need to hide these fields on the forms on which this information will be captured. That will look like this:


With this in place, you'll gain better insight into how every marketing dollar is being spent. You'll also be able to create a complete picture of your efforts, from last-touch to multi-touch attribution across both page content and channels at a contact level.

Have any other questions on how to implement this? Give us a shout!

The Ultimate Guide to Inbound Marketing - Free Download

Topics: Demand Generation, Reporting & ROI

About The Author

Matthew Buckley is a former New Breeder.

Ready to transform your current marketing + sales teams?  Request a free assessment and get started today. Free Consultation