Integrate Traffic Source & Referral data in your CRM

Integrate Traffic Source & Referral data in your CRM

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


Hussain Mehmood

Hey I am Hussain Principal Analytics Consultant @ MarketLytics focusing on measurement strategy and analytics implementation. I started marketlytics in 2010 to turn my passion for understanding user behaviour into my day job. I use & extend google analytics, tag manager and kissmetrics everyday to deliver performance measurement & data driven insights.