I’ve seen this question a zillion times, so please link the hell out of this so it shows up in search results and helps people (Matt Cutts, please ignore the previous statement, I’m just trying to help people). I also posted this at the Google Analytics help forums and will do a post on Search Engine Land next week, so hopefully one of these will rank and the world will be a happier place.
ONCE AND FOR ALL! LET’S DO THIS! 🙂
Google Analytics will report the ORIGINAL referrer to the ORIGINAL requested page if a server-side 301 (or 302) redirect is in place.
Let’s shake out an example.
You own mySite.com and have a page called unicorns.html. You decide that you want to make a better page for this, so you make “DOUBLE-unicorns.html”.
Then you realize that you want to remove the original unicorns.html because it is lame compared to your double unicorns page, but you want to make sure that people who linked to that old page see the new, awesome double unicorns page. Because you’re a good, SEO-conscious person, you do a 301 redirect from “/unicorns.html” to “http://www.mySite.com/DOUBLE-unicorns.html”.
OK, breathe…here we go.
Let’s say that the site unicornUniverse.com loved your original page, and had a link on it. Now that your 301 redirect is present, what happens when someone clicks on that link at unicornUniverse.com? What shows up as a referrer?
Yes: unicornUniverse.com is the referrer! And what is your landing page? DOUBLE-unicorns.html is your landing page.
This happens because the browser never actually sees the first file: the server redirects your browser and the field of the DOM that monitors your referrer isn’t updated. This field is referred to by the document.referrer variable, and a quick cheat to check what’s in it is to type the following in your location bar:
If you’re a browser ninja, you might have firebug installed, and you can look at the DOM map there to see the same thing.
Let’s take another example:
What if someone searches for “super awesome unicorn page” on Google, just MINUTES after you put your redirect up? Well, Google hasn’t had time to find your redirect and update the URL in their index! OH MY! What will happen?
All is well in the world (almost, see the last paragraph below for what’s not well in the world), because when someone clicks the link to http://www.mySite.com/unicorns.html in the Google search results, they will be 301 redirected to http://www.mySite.com/DOUBLE-unicorns.html. Referrer? google.com (the document.referrer will actually read: http://www.google.com/search?q=super+awesome+unicorn+page — that is how it knows your search engine keywords). And again, DOUBLE-unicorns.html will be the landing page.
So, direct is direct, search is search, referred is referred.
Lastly, webkit-based browsers (Chrome and Safari among them) have a known problem with opening content in new tabs and windows. If a user right-clicks a link and selects Open in a New Window or Open in a New Tab, referrer data is LOST! MIND BLOWN! But if they simply hold CTRL or command (on a mac) while they click to launch in a new tab, referrer data is preserved. DOUBLE BLOWN!
KEEP IN MIND:
If you are using 301 redirects, make sure they preserve your tracking parameters (utm_source, etc., at the end of your destination URL). Commonly, parameters that may specify display, email, or paid search campaigns may be stripped. What happens here? The URL of the referring site becomes a referrer and your campaign information is lost.
1) Your email that someone reads on Gmail should be counted as source:”email” medium:”email” campaign:”super email campaign”
if you forget to keep your URL parameters, instead of this visit being attributed to the email campaign, it will count as a referral from google.com! WHAT?!? Yes!
2) You are running a paid search campaign and have the keyword “unicorn site.” You expect source:”google” medium:”cpc” campaign:”generic unicorn terms”
if you forget to keep your URL parameters, instead of the paid search campaign being recorded, this visit will be attributed to NON-PAID search!!! Holy shnikeys!
The last thing to keep in mind is that before 301 destination pages replace your original pages in search engines (or if you use 302 redirects, and the URLs are not replaced in that case), your actual link URL from the engines and your Entry Page will NOT be the same! In the example above, Google linked to http://www.mySite.com/unicorns.html, but the entry page was DOUBLE-unicorns.html. If you’re trying to compare traffic to entry pages with your ranking reports (tisk tisk for running ranking reports!), they will not mesh up if you marry them by URL!