Tracking Original and Last Touch Referrer

Anonymous
Not applicable

Tracking Original and Last Touch Referrer

We are trying to track some organic traffic to measure the impact of some return visitors via social and other channels. Marketo populates the Original Referrer field but this doesn’t help for return visitors as the Original Referrer field always stays the same.

Question: How can you track the last referring URL? Is there some java code/cookie info we could add to the site that captures the last referring URL and capture it in a overwritable field called Last Referrer.

Example:
  • John visits 1st time from LinkedIn so Original Referrer=LinkedIn
  • John visits the following week from Facebook, how can we grab that Facebook visit?
Other Notes
We are trying make it easy for some 3rd party vendors to add URLs to their sites without the use of URL parameters. The # of content assets and channels makes using URL parameters a bit difficult.
Tags (1)
5 REPLIES 5
Anonymous
Not applicable

Re: Tracking Original and Last Touch Referrer

You can get the referral URL using JavaScript (document.referrer). You can create a hidden field on the form, set a cookie with that referrer information, and grab the data from the cookie in the form.

I love stuff like this so I'll see if I can get it working 🙂
Anonymous
Not applicable

Re: Tracking Original and Last Touch Referrer

Well, instead of setting it by cookie, I set it using JavaScript. I haven't tested this out except for Chrome, but it should get you started.

Assume your hidden field's ID is "latestReferrer".

<script>
$('#latestReferrer').val(document.referrer);
</script>

If you go to this testing page: http://go.servicetrade.com/Testing-Program_Testing-2-Column.html, you should see an alert that shows you that the Marketo community is your referrer. If you want to submit the form, I'll post back your Marketo record so you can see that it works.

EDIT: 10:30am 8/18/14 As of right now this code only works if you are referring from an HTTP (not HTTPS) page, unless your Marketo is served via HTTPS, in which case it might work; secure pages do not pass a referrer header to non-secure pages (Source). Looking for a workaround.
Anonymous
Not applicable

Re: Tracking Original and Last Touch Referrer

After a little more research, all hope is not lost:

http://smerity.com/articles/2013/where_did_all_the_http_referrers_go.html

Most major sites that are running HTTPS all the time (Google, LinkedIn, Facebook, etc.) are now setting a manual referrer value that gets passed to your page. See this screenshot. Facebook is HTTPS, my Marketo page is HTTP:

0EM50000000SIMP.jpg

0EM50000000SIMU.jpg

You won't get any more information other than the domain (or whatever the site wishes to pass to you), but it's better than nothing. Hope this provides some value to you 🙂
Anonymous
Not applicable

Re: Tracking Original and Last Touch Referrer

This is awesome Jason. I am going to contact you offline.
Anonymous
Not applicable

Re: Tracking Original and Last Touch Referrer

Jason, Jeff,

Have you two noticed a very high amount of people coming in via "direct" traffic. About 30% -40% of new leads are reported as direct traffic in Marketo which is much higher than Google Analytics (less than 10%).  

It looks like the refferer url is not passed to alot of our leads and Marketo picks up the first page a lead visits on our website.