Using Google Analytics with Internal (Intranet) SharePoint Sites

This article applies to both MOSS and WSS and is very easy to implement.

You may ask the question how does Google know about an internal user accessing a SharePoint site, well its simple. The Google script that runs is done so every time a user accesses the site and is therefore client side so it is the client session that registers the hit with Google Analytics (GA).

To implement Google Analytics successfully you will firstly need a GA account. From this account enter the SharePoint URL e.g. HTTP://intranet (don’t worry about Google resolving this to your SharePoint site because obviously it won’t!) follow the instructions and you should generate some code similiar to below:

<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">
try {
var pageTracker = _gat._getTracker("UA-XXXXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}</script>

Copy the code and place this into the active master.page for your SharePoint Site under the <HEAD> section and not just above the </BODY> section as is suggested in the Google walkthrough.

Hit the pages a few times and then keep checking your GA for stats. It will take up to 24 hours to update these stats however when you first implement your code the GA site will show a yellow warning triangle suggesting the analytics code hasn’t been installed, after a couple of hours this should change to confirm it has.

Wait 24 hours and you should then see some results come through and you’re done!

Credit to Mike Knowles blog for his excellent guide on this.

0 comments:

Post a Comment