You can easily configure the content search web part to show the pages that where viewed most in the last 14 days. You can also configure it to show other recommended pages for the current page that user is viewing. That is all good and out-of-the-box. In SharePoint 2013 term, page view is an analytic event and event is tracked in the analytic event store. The output of analytics processing goes into search index and this is how the search result ranking can be influenced by usage behavior.
What is even cooler is that you can create and track your own analytics event and influence search ranking the way you want it. For example, let say you want to be able to rank page by the helpfulness. The tricky thing with helpfulness is that it is transient in nature. An article page about how to use a technology could be very helpful at time but as the technology fades out, the page may no longer be helpful. The helpfulness must change over time and this is what analytics really shine.
Here is the outline of what you need to do to achieve the above scenario:
- Create a custom analytic event type called "HelpfulEvent"
- Put a link "This is helpful" on the page layout and wire up the script to log the analytic event the link is clicked
- Configure Content Search Web Part to show pages sorted based on the helpful event
Creating a custom event
To create a custom event, you will need to use PowerShell. The following script shows a listing of all the existing events in the system including out-of-the-box events.
$ssa = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $ssa.GetAnalyticsTenantConfiguration([Guid]::Empty)
$tenantConfig.EventTypeDefinitions | select eventTypeId,EventName | ft
The following script creates the custom event called "HelpfulEvent".
$EventGuid = [Guid]::NewGuid()
$EventName = "HelpfulEvent"
$tenantConfig.RegisterEventType($EventGuid , "HelpfulEvent", "")
$tenantConfig.Update($ssa)
$customEvent = $tenantConfig.EventTypeDefinitions | where-object { $_.EventName -eq $EventName }
$customEvent.RecommendationWeight = 5
$tenantConfig.Update($ssa)
You should have something like this on the screen inside SharePoint 2013 management shell.
You need to pay attention to the EventTypeId and the two ManagedPropertyName. In this case, Our HelpfulEvent is mapped to UseageEvent2Recent. When you configure the Search Content Web Part, you will want to sort the result by this Managed Property if you want to result to be sorted by Helpfulness.
Once you have the custom event created, the next step is to provide user a way to endorse if the page is helpful. In this example, we will put a button on a page layout. Upon clicking the button, an analytic event will be logged against our custom event "HelpfulEvent".
Click the button a couple times and you will have to wait for the analytic process to kick in which happen every night at 11:30pm. I was told it is not configurable. This means you will likely need to wait to see the ranking changes the next day.
There is an out-of-the-box page that allows you to see pages sorted by managed property. You can use it to see the actual number of hits against your custom event. You can get to this page by clicking on the "Most Popular Items" button in the Library ribbon shown below.
The page shows two interesting columns called "Recent" and "Ever". The Recent column shows number of hit since the last 14 days (configurable per Event Type). The Ever column shows number of hit since the page was created (left time of the page).
To show a list of most helpful pages in the last 14 days, use the Content Search Web Part and configure the sort by "UsageEvent2Recent"
With that you get a dynamic listing of helpful pages endorsed by your user community.