Orange is my favorite color

My company uses Hubspot to help support our marketing efforts. One thing Hubspot provides is great tracking that shows all of the touch points you have with a potential customer as they read your blog, download your content and fill out your forms. This helps form a cohesive picture of where someone is in the sales funnel and their interests and needs.

As a Software-as-a-Service for online event registration, however, we face the dilemma of separating out potential customers of our SaaS app and their customers who come to our site to also participate in the marketplace. For every event organizer who visits our site and might be interested in using our system, hundreds of event attendees come to get registered. Including the Hubspot tracking code on our home page makes our traffic numbers look great but has the negative side effect of dropping our lead and conversion ratios well under 1%. Ignore for a moment that this is demoralizing, it also makes reports difficult to use. Picture comparing the success of a landing page with 0.05% conversions and another with 0.07%. They both look effectively equivalent because of the scale but if those numbers instead read 50% and 70%, you would not only be impressed but recognize the latter is performing 40% better!

One option here would be to simply remove the tracking code from the home page and that would fix the statistic and volume issues. But we would lose important referring data. While Google is no longer giving us much in the way of search keywords, we still can see referring URLs when people surf to If we removed the tracking code from the home page and cookie’d them when they hit the About Us page, we would lose that original traffic source.

So, the challenge began to find a way to cookie the people who were potential leads and do it on the home page so we could capture referrer data. I asked our sales guy, our onboarding rep and customer support. Nobody had any idea how to segment the traffic to weed out the event attendees from skewing our data.

But I had an idea, and it turns out it works pretty well.

What I want to know, specifically, is when someone views our “How it works” or another marketing/sales page as that indicates interest in our SaaS product. I started by tagging all links in the top and bottom navigation that link to our marketing and sales pages with a CSS class like:

< a href="/about" class="hs">How it Works< /a>

On those marketing pages, we include the Hubspot tracking code on every view. But for the home page, I wrapped it inside of a jQuery click handler:

// dynamically load hubspot code only if someone clicks a marketing-related link on the home page
var anchor = $(this), h;
h = anchor.attr('href');
if (typeof _hsq === "undefined")
$.getScript('//'+(Math.ceil(new Date()/300000)*300000)+'/{your-hubspot-id}.js', function(){
setTimeout(function(){window.location = h},1000);

The code basically says: if someone clicks a link with the class “hs”, grab the link they clicked, load the Javascript file from Hubspot’s servers, wait 1 second, and then continue to the original link. In the 1 second while we sleep, the code should load from Hubspot’s servers which results in the user getting cookie’d appropriately and Hubspot can still access the referring URLs, search keywords, etc.

This approach is not only limited to Hubspot. It would work equally well with any Javascript-based tracking code like Google Analytics or others if you had some reason to exclude certain users from participating under certain circumstances.

It’s not perfect – the one second pause is too long in some cases, not long enough in others, and adds a delay in all cases which can increase page abandonment. However, we’ve been using this in production now for about 3 months and it’s been working well. Lead volume is slightly up despite the brief delay and we see the full browsing history for contacts in Hubspot. Our lead and traffic numbers are now properly scaled so we can make sense of the data we’re seeing.

If you have multiple audiences viewing your site and only want to apply tracking to some of them, this technique is worth taking a look at.

Comments are closed.