How to get Search Analytics Reports programmatically in SharePoint 2013

Radu Tut

In SharePoint 2010 it was possible to obtain reports from web analytics programmatically using Microsoft.Office.Server.WebAnalytics.Reporting.AnalyticsReportFunction class.However, in SharePoint 2013 the Web Analytics Service Application was merged into the Search Service Application. It seems now that the old assemblies used for this (Microsoft.Office.Server.WebAnalytics.dll and Microsoft.Office.Server.WebAnalytics.UI.dll) are not available any more.

In SP 2013 UI, the reports are available at these locations, as “Usage Reports”

  • CA->Application Management->Manage Service Applications->Search Service Application->Usage Reports
  • Site Settings -> Site Administarion ->Popularity Trends -> View Usage Reports

These reports can now be obtained programmatically using SearchServiceApplication class, from Microsoft.Office.Server.Search.dll. There are two methods available for these:

Although there are more reports that can be obtained from the SSA, i will only explain these two options.

Search analytics data is kept in a SQL database – AnalyticsReportingStore. GetSearchReport is based on SQL stored procedure ar_procGetTopSearchReport and GetRollupAnalyticsItemData is based on ar_procGetAnalyticsItemData.

GetSearchReport has the following parameters:

  • reportType – int :…

View original post 185 more words

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s