Site usage stats

Aug 2, 2012 at 12:23 PM

Hi all,

I've seen various docs about getting details relating to a chosen site - one area I would like to explore further is retrieving site usage stats. Does anyone know if this is something that can be achieved with SPServices, or do I need to be looking elsewhere?

Thanks,

Alex.

Coordinator
Aug 2, 2012 at 2:47 PM

Alex:

Usage is collected in log in the file system and they aren't available via the Web Services. Many people simply add Google Analytics to their master page and capture things that way. It really depends on what you are looking for.

M.

Aug 2, 2012 at 2:50 PM

Hi Marc,

Thanks for letting me know - I half suspected this would be the case, but it was more a case of just trying to get to grips with SPServices, and what it can / can't do. It's still an awesome library to play with though - keep up the good work!

Cheers,

Alex.

Oct 29, 2014 at 1:00 PM
Edited Oct 29, 2014 at 1:03 PM
I know this pretty old and may not help the original user anymore... But it could help someone else. I had a requirement from a client that wanted the site usage information from SharePoint (specifically the page counts) for more than the 30 days that SharePoint Shows you. As Marc said above this data isn't available via web services so I had to come up with something else.

I ended up using the UpdateListItems call onLoad from the master page, I created a list on the site to collect the data. I grabbed the URL each time a user visited the page so they created a list item telling us the basics Who, When, Where.

From here I had a massive list with the data, and you just need to do whatever it is you want with it. I ended up pulling it into Tableau and working with it there. You could use this to track just about anything by calling UpdateListItems at a certain time. You could get searches by calling it when a search is performed, or get time spent on a page by calling onLoad and unLoad.

A lot of users don't like the format or the limitation of the native SP usage reports anyway, so this gets you the raw data to do whatever you like with.

Obvious draw back is that the list is going to get very large, I archive mine every so often and start fresh.

basic code example below:
var pathname = document.URL
 
  $().SPServices({
       operation: "UpdateListItems",
       async: false,
       batchCmd: "New",
        webURL: "http://sharepoint/yoursite",
       listName: "listnamehere",
       valuepairs: [["Title", pathname]],
        completefunc: function(xData, Status) {}
    });