PDA

View Full Version : Tracking code for the 404 error page


jessica
02-18-2008, 04:17 AM
Hi,

Following is the tracking code that needs to be placed on the 404 error page, if you are using the new GA code.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? " https://ssl ." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + " google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxx-x");
pageTracker._initData();
pageTracker._trackPageview("/404.html?page=" + document.location.pathname + document.location.search + "&from=" + document.referrer);
</script>


Can anyone explain this part of the analytics code?

var gaJsHost = (("https:" == document.location.protocol) ? " https://ssl ." : "http://www.");


Since, I am using this analytics code for my blog, just wanted to be sure that this code would serve the purpose.

AussieWebmaster
02-19-2008, 10:17 PM
the https is calling a ssl - security certificate

beu
02-20-2008, 12:50 AM
not using the https url in secure page will give users a security warning