Usability, content, search and analytics on the corporate intranet

How to setup Google Analytics on an intranet

14 February, 2010 – Luke Oatham

This post highlights what you need to think about when setting up Google Analytics on an intranet.  Where detailed instructions are available elsewhere I have included links.

Your intranet and web access

Check that staff can access specific Google pages on the web and that your intranet URL is ok.  For example http://intranet won’t work. See specific Google pages.

If your company imposes restrictions on web access you may have to ask to add these addresses to the whitelist of allowed URLs.

In addition, your browser must run javascript and allow cookies.  See first-party cookies.

Get yourself some Google accounts

You need a Google account.  You can register your work email address; this makes it easier when setting up reports later.

You need a Google Analytics account.  Sign up for a Google Analytics (GA) account using the email address registered against the Google account.  You’ll need to create a profile in GA in order to get a profile ID, something like UA-1234567-1. This is the magic profile number that you need to include in your intranet pages.  See examples of the tracking code.

Add the google code to every page

In the process of creating your profile, you’ll see a piece of javascript code that you need to embed into your intranet pages.  This code needs to appear in your published HTML pages.  You’ll need to add the code into your HTML templates or includes or manually into every page.  Google only tracks pages that have the code.  See how to install the tracking code.

Decide how to tackle downloads

The Google tracking code only tracks HTML pages.  It will not automatically track Word documents or PDF files etc.  There are two methods to use in order to track downloads, depending on whether you publish via CMS or manually.

Tracking downloads with a content management system

Inside every anchor link for documents that you want to track, you’ll need to add an extra piece of javascript that will be triggered when the user clicks the link.  See how do I track files?
To track documents, I’d recommend using the URL as it would appear in the natural intranet folder structure:
onClick=”javascript: pageTracker._trackPageview(‘/pensions/docs/membership-form.pdf’); ”

Tracking downloads with manually published HTML pages

Tracking documents for manually published HTML pages is a little trickier, since you won’t want to add bits of javascript to your pages every time you add a link.  There is a javascript trick that we use which runs when the HTML page is loaded and will then seek out all links to documents and add the necessary Google tracking code.
The code will vary depending on your browser and intranet configuration.  I’m not a javascript programmer so please check these websites for ideas (we had to tweak the code to make it work for IE6 – no surprises!)

Tracking downloads from your search engine

Similarly to links to documents within your HTML pages, you’ll need to add code to your search engine results page to track links to documents.

What else do you want to track?

Campaigns

  • Track links from an email promoting an intranet page
  • Track links from a PDF newsletter

Add a bit of code to the end of your URL links from any medium (email, PDF, Word doc etc.)
See the Google campaign URL builder and guidance on using the buider.

Events or user interactions

  • Track “clicks” on a voting button
  • Track “plays” of a video

See the Google event tracking guide.

Limitations

There are a few loopholes and some situations where you can miss tracking.  For example, if you have embedded URLs in a document that link to another document then Google Analytics won’t know about it.  If other intranets or websites link to a document on your intranet then this won’t be tracked. Where possible, encourage external sites to link to your intranet page that contains your download document, rather than the download document itself.

5 responses to “How to setup Google Analytics on an intranet”

  1. Luke Oatham says:

    Google now has newer tracking code, but the code above will still work.

  2. Venkat says:

    Does the fully qualified domain name of the intranet needs to be accessed from outside world or just within the company network ?

  3. Luke Oatham says:

    You don’t need to let Google in from the outside, but you need to be able to access Google from inside.

  4. Robb says:

    There are some other considerations with using Google Analytics to track your Intranet site, outlined here:
    http://www.analyticsmarket.com/blog/google-analytics-and-intranets

  5. 76Leila says:

    Hi admin, i must say you have hi quality posts here. Your blog should go viral.
    You need initial traffic only. How to get it? Search for;
    Mertiso’s tips go viral

Leave a Reply

Your email address will not be published. Required fields are marked *