Here’s an example:
Lets say the original page is page.html and we have a test page page_1.html
Before the test, page.html got 1,000 visitors a day coming from Google searches (organic traffic).
So we have Google -> page.html
Now that the test is running you’ll have 500 visitors to page.html:
Google -> page.html
and 500 to page_1.html
If the web analytics code is after the redirect on page.html (which is what Google tells you to do) then data based on the HTTP referer will be incorrect (traffic source, keywords, etc).
If you REALLY want to capture the HTTP referer related data you can put the analytics code before the redirect. You’ll now be able to capture the original HTTP referer data, but you’ve also just inflated the page views.
I’ve solved this issue for some in-house code that uses the referer data by simply storing the HTTP referer value in a cookie right before the redirect, and then using the cookie value on the test page.
Unfortunately Google Analytics doesn’t do this.
Here’s a feature request for the Google Analytics team:
Add a way pass in the HTTP refer data manually.