/ Published in: JavaScript
Expand |
Embed | Plain Text
<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"> // Gives us an easy way to tell if an item is in the array Array.prototype.inArray = function (value) { var i; for (i=0; i < this.length; i++) { if (this[i] === value) { return true; } } return false; }; // Set up our array of valid host names hostArray = new Array('www.DOMAIN.com','DOMAIN.com'); // If the current host name is in the array, send the tracking info to Google if (hostArray.inArray(window.location.hostname)) { var pageTracker = _gat._getTracker("UA-XXXXXXX-X"); pageTracker._initData(); pageTracker._trackPageview(); } </script>
Comments
Subscribe to comments
You need to login to post a comment.

Heads up, Google now offers a new tracking code called ga.js. It offers a lot of new features such as analytics for internal search engines.
good job, saves a buncha time