Save the referrals!

I ran across an interesting question on the yahoo web analytics group.

Paraphrased: If you have a short easy to share/print/send email like www.mysite.com/cool and that redirects to the user to a long ungangly url like www.mysite.com/much/longer/url/to/get/customer/to/admit/that/ie6/is/thedevil.htm. What happens to the referrer data/info?

Short answer? Most likely it is lost and your redirect will strip out that precious referrer data. But, it does not have to depending on how you have your redirects set up.

For this example lets assume that you use a common redirect folder called “redir” . So when you print or create a short easy to share email for your new campaign you want to sent out or shared.

www.site.com/redir/ie6isthedevil

And when a user types this in, or clicks on the link from an email they get taken to

www.site.com/its/true/ie6/is/the/devil.ftw

However, as the question above highlights, the referrer data from page to the short url is lost. Fortunately, this fix to this is easy. On the page that contains the actual redirect code, place this JavaScript in place.

<script language="javascript">
document.url = document.referrer;
</script>
.
.....
(redirect code in language of choice)

It merely copies the referrer data into the DOM URL object on the redirect page to pass it along to the long final url. Then all of your web analytic tracking code will function as expected. (I tested this in Omniture & Google Analytics)

That’s it!

-Rudi

Leave a comment

Your email address will not be published. Required fields are marked *

Are you human? Or are you Dancer? *

4 thoughts on “Save the referrals!”