Thursday, April 9, 2009

SharePoint (MOSS 2007) Analysis with Google Analytics

SharePoint (MOSS 2007) Analysis with Google Analytics

GA is a web analytics package provided free by Google.  I heard about this tool some time ago but never got any chance to use it. The very moment I heard of this tool, I got some illuminance as I can use it for SharePoint Site analysis.

We can apply GA to only one page OR whole site (master page). I'll explain both the ways one by one:

Applying GA to SharePoint Site Master Page:

Follow the Steps mentioned below:

  1. Obtain the Fully Qualified Domain Name (FQDN) for your MOSS site.

    For example, given a local hostname myhost and a parent domain name, the fully qualified domain name is

  2. Create your Google Analytics account (see detail below). FYI, you don't need to pass any authentication in order to track hits to your site.

    When you set up your new account, you need to enter your FQDN in the URL field, and you need to enter it the way they specify:

  3. Add the GA tracking code to your site's master page within the HTML tags, which will allow you to analyze all the sub-pages, not just the home page. 

    Finding your personalized Google Analytics Tracking Code
    The tracking code is profile-specific, which is why you can only access it via the Profile Settings page for a specific profile. Below is an example of what the code snippet will look like. The symbols "xxxxxx-x" in the sample below is Google Analytics account number. You can find it in your personalized Google Analytics Tracking Code.

    Note: Google has created separate scripts for secure and non-secure URL. So while adding the Web Site URL in Step-2, you can select "http" OR "https". It will give you the appropriate script.

Point to be pondered:

I just want you to go back to Step-1, where I mentioned abut FQDN. But to work with MOSS what really needs to be entered for the Website URL is the full URL with the /pages/default.aspx ending. For example; if your domain is you would enter  This is because Google won't like the fact that it's getting redirected to /pages/default.aspx and will bail if you don't provide that part. For setting this full URL you have two options:

Option 1:

  1. From the home page of your Google Analytics account, click Edit:

  2. Click Edit at the upper right in the Profile Settings window:
  3. At this point you can change your website URL.  For the example I'm using, you would enter:


    For Example:


Option 2:

Option 2 is not much different from Option 1. Here in Option 2 you can keep your Website URL as FQDN and in addition you can specify the Default Page (i.e. default.aspx) also.

Note: After completing all the steps below, please be little patient as it will take 24 hours for Google to display your report.

Applying GA to SharePoint Page:

Applying Google Analytics to only one page includes all the steps for setup of Google analytics account. Other than that we need to perform some actions which I'm mentioning below:

  1. Add a Content editor Web Part to our SharePoint Site Page.
  2. Click on 'Modify Shared Web Part'.
  3. Click on the 'Source Editor'

Paste the Java Script provided by GA in this Source Editor. Click Save and then Click OK.

No comments:

Post a Comment