framebusters direct traffic issues and the google analytics _setReferrerOverride() solution

Uncategorized — facesaerchteam @ 3:14 pm
hi, as i’m currently testing this, please spread/retweet this

RT @enzenhofer http://ow.ly/fuLl framebusters GA referrer tracking fix

thx a lot

URL shorteners are in (thx to http://twitter.com/), not all url shorteners are nice to websites, a lot of them use frames (which are not cool for SEO) oh yeah, and in some cases the frames even break google analytics tracking code in IE6 (yeah, stupid IE6). that’s why it is a viable option to use so called framebusters.

i.e.: searchengine land uses this simple code

<script type="text/javascript">
<!--
if (top.location!= self.location) {
top.location = self.location.href
}
//-->
</script>

ok, the challenge with this approch is: if you get a lot of refereed inframe traffic you suddenly get a lot direct traffic as this javascript mumbo jumbo looses the original referrer.

how to fix this

there is an undocumented GA function
( thx to http://www.prusak.com/google-ananlytics-initial-referrer-update/ )

pageTracker._setReferrerOverride()

we adapt this framebuster script

<script type="text/javascript">
<!--
if (top.location!= self.location) {
document.cookie = "realreferrer="
+encodeURIComponent(document.referrer)+"; path=/";
top.location = self.location.href
}
else
{
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==” “) c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0)
   return c.substring(nameEQ.length,c.length);
}
return “”;
}

var realreferrer = decodeURIComponent(readCookie(”realreferrer”));
document.cookie = “realreferrer=; path=/”;
–>
</script>

oh yeah, and you adapt your tracking code to something like this

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXX-Y");
if (realreferrer.length > 0) {
pageTracker._setReferrerOverride(realreferrer);
}
pageTracker._trackPageview();
</script>

now the real referrer is submited (and then deleted) via cookie to frameless page. where it is submitted to the holy google analytics. job done, traffic referrer stats rule again.

hi, as i’m currently testing this, please spread/retweet this

RT @enzenhofer http://ow.ly/fuLl framebusters GA referrer tracking fix

thx a lot

(c) 2017 facesaerch blog