Just going through some of the threads trying to find out how to install Google Analytics into our own vBulletin installation, I noticed a lot of people really concerned about where the code goes, and were quite paranoid that they couldn't find a </body> tag, like google suggests.
So I wanted to clear a couple of things up.
First of all Analytics doesn't NEED to go before the end of the body tag, its suggested to go there, for a couple of reasons, first of all, Google knows that because some people don't have the fastest connections, or aren't close to a google connection, the load time may be slow. So placing the code near the END of the page, ensures everything else on your page loads first.
So the code would go near the bottom of the footer template (STYLE MANAGER/EDIT TEMPLATES) like so:
Second, no one can abuse or USE any of the advanced functionality that the urchin Javascript file includes.
For instance, all of our sites, use the Analytics code, just after the body tag starts (in vBulletin users case, that would be at the top of the header, in the header template) Why?
Because now we can use advanced functionality, we can track any clicks, images, mouse movements, clicks, form submissions, page leaves, anything. Just by adding some code to whatever we want to track.
For instance:
If I put the code in the header like so:
I can now track anything I want.
So I have a link that goes back to my main site/home page, and I want to know who/how many times/what keywords they came in from, etc.. everytime they click on that link.
So my footer code has the link in it:
To add tracking everytime someone clicks on it I do the following:
I can put anything I want in those brackets. 'clicked on home', 'went to analytics support.com' 'externalclick/analyticssupport.com'
And it will show up in analytics just the way I've written it.
Also, I can track anything, by just changing the onclick= to whatever I'm wanting to track. For <FORM tags, I use onsubmit= for images <IMG, I could use onmouseover= to track when someone actually sees and passes over an img, etc...
If you are looking to do this, and notice your page taking a long time to load, you can download the urchin.js file, and place it locally on your server. However, if you do this, you MUST update it at least once a week, for safety and accuracy's sake.
Hope this clears things up.
David...
google.AnalyticsSupport.com
google.AnalyticsSupport.com/blog
google.AnalyticsSupport.com/forums
So I wanted to clear a couple of things up.
First of all Analytics doesn't NEED to go before the end of the body tag, its suggested to go there, for a couple of reasons, first of all, Google knows that because some people don't have the fastest connections, or aren't close to a google connection, the load time may be slow. So placing the code near the END of the page, ensures everything else on your page loads first.
So the code would go near the bottom of the footer template (STYLE MANAGER/EDIT TEMPLATES) like so:
HTML Code:
...PREVIOUS FOOTER CODE... <!-- / auto DST correction code --> </if> <script type="text/javascript"> <!-- // Main vBulletin Javascript Initialization vBulletin_init(); //--> </script> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-XXXXXXX-X"; urchinTracker(); </script>
For instance, all of our sites, use the Analytics code, just after the body tag starts (in vBulletin users case, that would be at the top of the header, in the header template) Why?
Because now we can use advanced functionality, we can track any clicks, images, mouse movements, clicks, form submissions, page leaves, anything. Just by adding some code to whatever we want to track.
For instance:
If I put the code in the header like so:
HTML Code:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-XXXXXXX-X"; urchinTracker(); </script> <!-- logo --> <a name="top"></a> <table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center"> <tr> <td align="$stylevar[left]"><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td> <td align="$stylevar[right]"> ...REST OF HEADER CODE...
So I have a link that goes back to my main site/home page, and I want to know who/how many times/what keywords they came in from, etc.. everytime they click on that link.
So my footer code has the link in it:
HTML Code:
<a href="http://www.analyticssupport.com" accesskey="9">AnalyticsSupport.com Home</a>
HTML Code:
<a href="http://www.analyticssupport.com" accesskey="9" onclick="javascript:urchinTracker('clicked on home'); return true;">AnalyticsSupport.com Home</a>
And it will show up in analytics just the way I've written it.
Also, I can track anything, by just changing the onclick= to whatever I'm wanting to track. For <FORM tags, I use onsubmit= for images <IMG, I could use onmouseover= to track when someone actually sees and passes over an img, etc...
If you are looking to do this, and notice your page taking a long time to load, you can download the urchin.js file, and place it locally on your server. However, if you do this, you MUST update it at least once a week, for safety and accuracy's sake.
Hope this clears things up.
David...
google.AnalyticsSupport.com
google.AnalyticsSupport.com/blog
google.AnalyticsSupport.com/forums
Comment