Integrate Traffic Source & Referral data in your CRM

Let's start

The post discusses how you can use our newly open sourced trafficSourceTracker.js to enrich your CRM data with marketing information.

Earlier, Google Analytics maintained a cookie with the source of traffic which was great for anyone looking to integrate traffic source data with their CRM. However, with the launch of Universal Analytics, all traffic source related tracking has moved internally to Google’s servers. While this has made it easier to send data from internal systems back to Google Analytics, it has left a gap for existing integrations that were using GA traffic source information to enrich CRM data earlier.


We recently set out to solve this problem for one of our clients. They were relying on having source information in CRM but the migration to Universal broke their integration. This led us to work on a fully featured library that ended up implementing the entire last non-direct click attribution model [1]. After battle testing it, trafficSourceTracker code is now available here for everyone.


The code, once added runs on each page and for every new user landing on the site, stores their traffic source, medium and keyword in a cookie. This source information can then be fetched from any page and passed onto a CRM or form.

You can read more detailed installation instructions here. In this post we’ll discuss some cases for putting this data to good use:


1- Enrich CRM Data with Traffic Source

This is the most popular use case and the one we directly went after. The main purpose is to provide more context about prospects to sales and marketing teams and allow them to easily see marketing channels in the tool they use the most. Generally, this is usually implemented by passing the traffic information into CRM on form submission as hidden form fields.

2- Enquiry Forms


It is also helpful to know where a user came from with any “Contact Us” requests etc. For example, whenever a form is submitted you can pass this info about traffic source along with it

traffic source with form submission

traffic source with form submission

We hope you benefit from this trick that can definitely help you track traffic sources for all your prospects and make marketing initiatives more data driven. Look forward to hearing from you on how it gets used!


[1]: last non direct click is a mouthful but it is basically the logic Google Analytics uses to process and attribute traffic source to a session and create the Acquisition reports. Here is the logic in all its glory


Don't miss out when new resources launch

Our customer analytics experts share wisdom only once a month

Share now
We are customer-analytics consultancy that transforms messy data into actionable insights that will help you grow your company and make better data-backed decisions.