Accessing the source data for a visitor via JavaScript


Any time a visitor hits a page with the tracking code installed, HubSpot goes through the machinations to determine the source for that visit (organic, direct, paid social, etc.).

Is there any way for us to access that source data via JavaScript? Is that stored in the _hsq object somewhere?

Example: visitor hits a HS page from organic search and HubSpot’s tracking code assigns it a source of organic and (I assume) puts that somewhere in the cookie. I want to be able to grab the sources bucket for the visit, as HubSpot has classified it, and send it to my own server.


@rsobers The bucketing is handled server-side and not on the client side. We just push the raw data over from the client. You could grab the referrer out of the cookie which could give you some insight. However, the assignment of the source is not done client-side.


If you just need the referrer, it’s a property on the document: