Carter Gilchrist
posted this on April 11, 2011 11:21 am
A quick and easy way to capture basic referral information (the URL that referred the visitor) is to use a bit of javascript and look for the 'document.referrer' value. There's no 100% guarantee with this, but it's a good way to capture most referrers and see where they're coming from and what they may have searched for to get there. Here's how to set this up:
<script type="text/javascript">
jQuery(function(){
jQuery('input#referrer').val(decodeURI(document.referrer));
});
</script>
That's it! You should start to see "referrer" showing up in your leads data and your email notifications.
If I search google for "landing pages" and hit the Unbounce.com link that shows up, my referrer information looks like this (I've broken it up into multiple lines):
http://www.google.ca/url?sa=t&source=web&cd=2&
ved=0CEEQFjAB&url=http%3A%2F%2Funbounce.com
%2F&rct=j&q=landing%20pages&ei=VEKjTdLrN8ffiALDuKyGAw
&usg=AFQjCNEdp5atllJolLmui3JnJ-LeqkqI7g
&sig2=WWeqREq70WX5qNiwMh3oIw
You'll notice the data is a bit unreadable at first (it's encoded, the script you're copying above will help decode it) but you can still see that the domain is google.ca and that the search query (represented by 'q' in this case) was landing pages (the %20 is just a space). Hope this helps you learn more about your leads!
Comments
This shall work with natural traffic (not being HTTPS blocked) but will it work with paid traffic (AdWords)? In case it won't, any idea on how to do it?
Thanks,
Is there anyway to modify the script to support/read links created by google's url builder?
http://support.google.com/analytics/bin/answer.py?hl=en-GB&answ...
Thanks.
I agree with Gil. It would be extremely valuable if there was a way to pass through the Google URL variables to the form.
Campaign Source, Campaign Medium, Campaign Term, Campaign Content and Campaign Name. Is it also possible to just display the Keyword as text and not as the entire URL?
Hey Gil, Brian - the above script doesn't actually need to be modified to capture Google's form data. In fact, any URL parameter will automatically populate the field on your Unbounce form with the same name.
Let's say for example, you've set up tracking through Google's URL builder and the URL looks like this:
http://listings.gastown-realty.com/?utm_source=google&utm_mediu...
If you add hidden fields to your Unbounce form for: