Using search to display usage statistics in SPO

Brass Contributor

Hi all,

I'm looking into using seach api or just search web parts to display usage statistics like most popular/viewed articles in a publishing portal in SPO. When I look at the search schema I find some promising managed properties, as you can see at the bottom of this post.

First: 
From what I learn in this blog post, the Recent time period, as in ViewsRecent, is by default set to the last 14 days. Is that still the case in SPO? Is there a way to change this time period with CSOM?

Second:
Is there any documentations of these managed properties and usage? Is the number values returned in these properties realtime, or is the number populated by the crawler?

Third:
Is there any other approch i can do to display these types of usage data? I looked into the Office 365 Management Activity API but that does not seem to be suitable for this use case (?).

In search schema:

Trend managed properties.PNG

In search result:

Trend managed properties 2.PNG


4 Replies

For an overview of the on-prem architecture, please review the following:

The SPO Search service works similarly.

 

Regarding your points:

First: You will not be able to change the SPO property. It is a service-wide setting, not per-tenant.

Second: I couldn't specific documentation of the managed properties, but the names match the information described in the Analytics Platform documentation linked above. Usage data is pushed into the search index every 15 minutes.

Third: These properties are your best approach using OOB functionality. Of course, you could add a javascript widget (Google Analytics or Application Insights) to your pages.

 

Thanks for your answer!

Hi @Christian Enghaug

 

If you want to view analytics and usage for your SharePoint site, like @paulschaeflein says, you can use Azure Application Insights. I used this feature for one of my project and it is really simple. You can either add the generated code into a script editor Web Part or use a ScriptLink to inject the code for all pages. Just follow this procedure https://azure.microsoft.com/en-us/documentation/articles/app-insights-sharepoint/.

 

I think using search may be too complicated for what you looking for.

You could also leverage the audit logs an aggregate across that to identify the most popular content: https://msdn.microsoft.com/office-365/office-365-management-activity-api-reference