googleanylitics Analytics software can be invaluable when it comes time to prove the worth of the SharePoint site you migrated your company’s intranet from, or when seeking that budget increase for more hardware.

The problem is with the nature of SharePoint sites being fluid, in that they are constantly changing as the data they serve is being updated or consolidated.  New features and web parts are being added, and so the code under the hood is always evolving.

This brings me to the problem I faced when a customer needed assistance in setting up analytics software on the SharePoint site.

There are plenty of sites that will walk explain the integration for MOSS 2007 and Google Analytics (GA), but none that I found for WSS 3.0.

The site I am working with is using a combination of default and custom Master Pages.

Following the directions found on the Google Analytics site, I registered my Gmail account with the Analytics site, registered the unique domain name (URL), and added the code (JavaScript) just before the closing Body tag within the site’s Master Page (/BODY).

GA_code

For the URL, be sure you register it exactly as it appears in the browser, for instance if you have alternate access mappings, you will need to register each as a separate domain. Also be aware of any redirects, for instance if you have a managed path, i.e., www.yoursharepointsite.com/sites/, then make sure you specify that path as your URL within the GA profile settings.

Once you have the URL set correctly, and the code loaded on all the master pages referenced by your site, you need only wait until the servers at Google pick it up.  The Analytics site states it could take as long as 12 hours; I have seen it take from 20 minutes, to 24 hours.  Patience is key.

You can verify the code is loaded by browsing to your site, and then viewing the page source code.

Alas….this did not work for me!  It seems that with the web part pages of SharePoint, there are just to many functions and hooks within the body tags.  The resolution was to put this in the header tag rather than the body tag.

Ganalytics

Once the code was in the HEAD section of the Master Page, in about 30 minutes, the site was checking out OK on the Google Analytics dashboard.

Hope it helps, and happy SharePointing!