I need to log when users click on specific links on our SharePoint site. Something like:

[email protected] - Clicked Special Link #1 - 02/13/2015 14:41

[email protected] - Clicked Special Link #7 - 02/13/2015 14:41

I can intercept the clicks with JavaScript if needed.

Any suggestions on how this can be done? Is there something built into SharePoint that I'm overlooking?

1 Answer 1


You can use the REST/JSOM API to log your own usage to show up in SharePoint usage analytics. For example the REST endpoint looks like this: "/_api/Microsoft.SharePoint.Administration.SPAnalyticsUsageService/logevent"

You can look at the full code example on doing this from JavaScript here: http://sharepointfieldnotes.blogspot.com/2013/11/more-sharepoint-2013-rest-code-tips.html

  • This looks good but it's not working for me. When I set EventTypeId to 0, I get back "Invalid parameter: EventTypeId."
    – matt
    Commented Feb 16, 2015 at 17:05
  • There is no documentation on the eventTypeId. It looks like the "custom" is limited to between 512 and 518. Try that. Commented Feb 16, 2015 at 23:01
  • The data object I get back has a property called logevent, but it's value is null. Where do you see the logs for custom events in SharePoint?
    – matt
    Commented Feb 16, 2015 at 23:40
  • The logevent always returns null.This may not meet your needs. You can only see the usage events using the "popularity trends" reports for sites, lists and listitems. The site usage can be generated from the "Popularity and Search Reports" in site settings. These will not show custom events. The only place custom events will show are on listitems. You select a listitem in a list, then select "Poulartity Trends" ribbon button after selecting the Files tab. You may be able to achieve this if your pages are contained in a document library like site pages. Commented Feb 17, 2015 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.