Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We have a multilingual website and the first page redirects to specific language page using 301 redirect based on some logic. For example: http://mysite.com/ redirects to http://mysite.com/en/

The problem is that these redirects destroy the primary request so we do not get correct results for traffic sources in GA.

How do you handle this case? Is there something that we can do? Any ideas will be appreciated

share|improve this question
2  
A 301 Redirect is a permanent redirect. It sounds like you are doing redirects to different pages based off of location for the IP. That could cause issues for Google's bot, like it will think your homepage is http://mysite.com/en/ and not http://mysite.com/. –  RandomBen Sep 9 '10 at 17:13
    
We use cookies not Geo IP and also we have links to all the language versions so the bot can index all pages. But yes you are right that this may confuse the spider. –  Ilian Iliev Sep 10 '10 at 6:56
    
The problem actually was that the referring site uses https and according to RFC2616(tools.ietf.org/html/rfc2616) "Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol." –  Ilian Iliev Sep 13 '10 at 9:13
    
The solutions for the real problem(the HTTPS referrer) can be seen here -> ilian.i-n-i.org/google-analytics-referring-sites-and-https –  Ilian Iliev Sep 17 '10 at 6:27
add comment

2 Answers

up vote 2 down vote accepted

Everything I can find suggests that the HTTP referrer is preserved through a 301 redirect. EDIT: Tested this in Internet Explorer 8, Firefox, Chrome and Opera and they all pass the original referrer through a 301 redirect.

However if you're sure that's not happening in your case, it appears you may be able to (unofficially) override the referrer in GA manually. So when the user visits mysite.com you could for example set a cookie with the value of the REFERER header, then on mysite.com/en/ pass that to GA.

share|improve this answer
    
thanks I give it little more investigation/testing –  Ilian Iliev Sep 10 '10 at 6:58
add comment

I've just finished testing Chrome, IE, and Firefox and I have found that across the board, none of them preserve the HTTP_REFERER string in the case of a 301 redirect.

I also tested when clicking on a LINK from one domain to another and again, across the board, ALL OF THEM preserved the HTTP_REFERER string correctly.

Is this new standard behavior for all of the browsers? Can anyone else confirm that they are experiencing the same behavior?

Here is what I did to test: On www.domainA.com in the .htaccess file:

RewriteEngine On
RewriteRule .* http://www.domainB.com [R=301,L]

On www.domainB.com in the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://www.domainA.com/$
RewriteRule .* http://www.somefakedomainname.com [R=301,L]

Then I visited www.domainA.com and watched what happened. I cleared the local cache for each of the browsers after updating the .htaccess files to test.

I then commented out the RewriteRule in the .htaccess file on the www.domainA.com domain and added a regular link pointing to www.domainB.com in the root index.html file for www.domainA.com.

In each case when I clicked on the link on www.domainA.com I got redirected to www.somefakedomainname.com after being directed to www.domainB.com.

In each case when I visited www.domainA.com WITH THE 301 REDIRECTION ENABLED, I got automatically redirected to www.domainB.com, but then I did NOT get redirected to www.somefakedomainname.com.

If a few of you guys could duplicate this test (or whatever method you'd like to use) and let us know if you're seeing the same behavior that would be awesome.

I did this with Bluehost.com being the hosting provider. I'm curious to see if somehow this is hosting specific (apache or IIS configuration related).

Thanks

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.