Page hit counter in MOSS

So, a customer of ours is upgrading to SharePoint 2007. One of the things they were looking for is a hit counter, so they can see the number of times a page was requested. This was easy for them to do in SharePoint 2003 – they’d just use FrontPage, and insert a Hit Counter web component. I’d never heard of such a thing build into 2007, but over morning coffee, I decided to give it a try. Much to my surprise, it works… …sort of.

There is a hit counter (albeit with an awful set of styles). It does work too:

Hit counter in SharePoint

That’s one of the better styles, believe it or not. So, what’s the problem with this?

Well, in normal pages, nothing. It counts; ’nuff said. However, publishing pages are a bit different. They store metadata in a ‘Page Content Type‘ and then use Page Layouts to render that data. What this means is that many things that appear to the user as separate pages actually use just one ASPX file for rendering their content – and this is where the hit counter doesn’t work. It counts the number of hits on the ASPX page – so instead of getting a number of hits on that page of content, you get the number of hits on content using that page layout. Which sucks a bit.

I’ll look into this a bit more soon, and see what I find. It can’t be that hard – apart from the whole ‘Page Layout’ thing, it’s not exactly rocket science.

Page hit counter in MOSS

8 thoughts on “Page hit counter in MOSS

  1. You can add hit counter to any page using sharepoint designer 2007
    Jus open the site and then click on insert web component and then Hit counter thats it

  2. Russ says:

    Correct. Doesn’t work on page layouts or master pages…unless you want to count the number of hits on your master page or page layout instead of the individual page!

  3. Tore Olav says:

    I doesnt have access to Sharepoint Designer, only the editor in the web browser.
    How can I add the counter?
    I cannot find it anywhere..

  4. I don’t think there is a way then. You may be able to use third party system – like google analytics – but only in certain circumstances.

    1. It does work, provided you are not using Publishing Pages in SharePoint. Though to be honest, there are better ways to get usage statistics, particularly in recent versions of SharePoint.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.