How to redirect and keep referrer data for web analyticsHow to redirect and keep referrer data for web analyticsHow to redirect and keep referrer data for web analyticsHow to redirect and keep referrer data for web analytics
Smarter Marketing

How to redirect and keep referrer data for web analytics

8 July 2010
How to redirect and keep referrer data for web analytics

by Alan

Data Specialist

share this article

As many will have heard, cool URL’s don’t change, but in the course of the life-cycle of a typical website it invariably happens. And when it does, the only reasonable solution is to redirect users to the new location for content.

Best practice is to use a server-side 301 (permanent) redirect as this is the only reliable method that works for SEO – helping search engines update your URLs, but what happens if you use other methods? Does the same thing happen in all browsers?

This is particularly important for URLs that are entry points on your site, as without original referrer data, you cannot know the source of sales and conversions on your site. Anyway, on to the results.

Redirect method Browser Result Impact on analytics
Meta refresh – 0 Firefox 3 Blank referrer Lost data
IE8 Blank referrer Lost data
Opera 9 Internal referrer Lost data
Javascript:location.href Firefox 3 Internal referrer Lost data
IE8 Blank referrer Lost data
Opera 9 Internal referrer Lost data
Javascript:location.replace Firefox 3 Internal referrer Lost data
IE8 Blank referrer Lost data
Opera 9 Internal referrer Lost data
Server-side 301 Firefox 3 Original referrer
IE8 Original referrer
Opera 9 Original referrer
Server-side 302 Firefox 3 Original referrer
IE8 Original referrer
Opera 9 Original referrer
Server-side 301 – chained Firefox 3 Original referrer
IE8 Original referrer
Opera 9 Original referrer
Server-side 302 – chained Firefox 3 Original referrer
IE8 Original referrer
Opera 9 Original referrer


Conclusion

While there’s nothing too unexpected in the results, it’s clear that the only way to redirect visitors and have reliable web analytics data is to use a server-side redirect. No javascript or meta-based method works, in all cases resulting in an empty or internal referrer (which will misleadingly show up as bookmark/direct in most analytics packages). Interestingly, javascript and meta redirects can result in totally blank referrer data in some browsers.

Server-side methods worked across all major browser tested, and you can get away with chaining redirects together while still keeping the referrer data.

share this article

Get in touch with us by completing the form

    About the author

    How to redirect and keep referrer data for web analytics

    Alan joined Receptional in 2016 and is part of the Link Building team. Originally joining as an apprentice, Alan is now responsible for outreaching content for one of our biggest clients. Away from work, he enjoys going to the cinema and attending sporting events.

    contact Alan

    Read our related articles below

    Blog

    112 takeaways from BrightonSEO

    13 September '21

    Justin

    by Justin
    Managing Director

    Blog

    WEB@30 heads to Cambridge, to celebrate 30 years since the first website launched

    19 July '21

    Luke

    by Luke
    Marketing Manager

    Stay up to date with our blogs by subscribing

    (Please note that you are subscribing to receive our newsletter and can opt out at any time)