Mobile app version of vmapp.org
Login or Join
Sims2060225

: Google analytics and 301 redirects 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

@Sims2060225

Posted in: #301Redirect #GoogleAnalytics #Multilingual #Redirects #Seo

We have a multilingual website and the first page redirects to specific language page using 301 redirect based on some logic.
For example: mysite.com/ redirects to 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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sims2060225

2 Comments

Sorted by latest first Latest Oldest Best

 

@Odierno851

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 domainA.com in the .htaccess file:

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


On domainB.com in the .htaccess file:

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


Then I visited 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 domainA.com domain and added a regular link pointing to domainB.com in the root index.html file for domainA.com.
In each case when I clicked on the link on domainA.com I got redirected to somefakedomainname.com after being directed to domainB.com.
In each case when I visited domainA.com WITH THE 301 REDIRECTION ENABLED, I got automatically redirected to domainB.com, but then I did NOT get redirected to 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

10% popularity Vote Up Vote Down


 

@Cofer257

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme