You can make ineffective the referrer that Google Analytics is utilizing, read further in the documentation for _setReferrerOverride. To someway give this accurate referrer, you require passing it through the 301 redirect. I can recommend adding a query parameter to your forwarded URL, and writing a JavaScript clip which will take out this information from the document.location. An instance of adding JavaScript to your Google Analytics code:
Code:
var _gaq = _gaq || [];
_gaq.push (['_setAccount', 'UA-XXXXXXX-1']);
var _from = unescape(window.location.href.replace(/.*[?&]from=(.*)/,'$1'));
if (_from && _from.length > 0) {
_gaq.push (['_setReferrerOverride',_from]);
}
_gaq.push(['_trackPageview']);
And, an instance of utilizing mod_rewrite to move the referrer, if a referrer exists:
Code:
RewriteCond %{ HTTP_HOST} ^example.com\.com$ [NC]
RewriteCond %{ HTTP_REFERER}! ^$
RewriteCond %{ HTTP_REFERER} (.*)
RewriteRule ^ (.*) $ http://shop.example.com/$1?from=%1 [R=301, QSA, L]
RewriteCond %{ HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^ (.*) $ http://shop.example.com/$1 [R=301, L]
You will require replicating the over for www.example.com too.
Bookmarks