If I redirect a user with window.location
or Meta Refresh or header(\'Location:\')
from xxxy.com to yyyx.com, then Google Analytics will show xxxy.com
There are 3 types of redirects. Google Analytics treats each of them differently. But, the one consistent thread is that it looks to the value document.referrer
. So, when in doubt, just check.
HTTP Redirect (Location:...
): Google Analytics cannot see this redirect, so if a user goes from A to B, and B triggers an HTTP redirect to C, Google Analytics will see A as the referrer. (For example, clicked bit.ly
links never get bit.ly
tracked as the referrer when users get redirected through bit.ly
).
META Refresh: Google Analytics will not see this as a "clean" redirect. So, if a user goes from A to B, and B triggers a META refresh redirect to C, Google Analytics will see B as the referrer.
window.location
: Google Analytics will not see this as a "clean" redirect. So, if a user goes from A to B, and B triggers a window.location redirect to C, Google Analytics will see B as the referrer, except in older versions of Internet Explorer (which will not list a referrer value in document.referrer
for JavaScript redirects.)