View Full Version : Google Analytics - Add to Template
Pixelfuss
06-12-2008, 07:02 PM
Hello,
I was thinking of signing up for Google Analytics, I currently have a modified version of the Horizon template and was wondering if someone could tell me whether or not I need the ga.js or urchin.js script? Also, where do I need to add the script, to all template pages? or just to one? Please help!
Thanks in advance!
outbackcamera
06-12-2008, 08:44 PM
I use Google analytics with the Urchin script on my own website (thought not with the Horizon template).
I put the relevant javascript code (script link, the account information and a call to urchinTracker) just before the closing body tags on each page. If i recall correctly the Google analytics website will generate this code for you when you join up but you have to manually add it to your pages (copy and paste).
You dont have to put the code on every page but only pages that have the code will be tracked.
Hope that helps!
fadattf
06-12-2008, 09:12 PM
You just have to copy (before the closing body tag) the code you get from google.
Should be something like:
<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("YOUR_TRACKER_NUMBER");
pageTracker._initData();
pageTracker._trackPageview();
</script>
If you want all your sites to be tracked you've got to put the code in all your template files.
Pixelfuss
06-13-2008, 12:10 AM
Thanks outbackcamera! I will use the urchin script and go for it!
Pixelfuss
06-13-2008, 12:11 AM
Thanks fadattf I will post the script in my template files and go for it!
outbackcamera
06-13-2008, 06:47 PM
I believe that the ga.js code is the newer version so you probably are better off using that. There's more info on the versions in the analytics website.
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.