This is a blog post in the series “How to display Recommendations and Popular items on a website”. In the previous post, I showed you how to display recommendations on a website with anonymous users. In this blog post:

About the usage analytics reports
The usage analytics reports show statistics of how visitors have interacted with the content on your website, for example which item has been viewed the most. The reports are broken down per usage event. This means that by default you’ll be able to see:

  • The number of views for an item.
  • The number of recommendations displayed per item.
  • The number of recommendations clicked per item.

SharePoint Server 2013 creates two usage analytics reports:

  • Most Popular Items – shows usage event statistics for all items in a library or list.
  • Popularity Trends – shows usage event statistics for an item, a site or a site collection.

The reports are automatically updated once every 24 hour when the usage analytics job is run.

View the Most Popular Items report for a catalog
In a cross-site publishing scenario where you are displaying catalog content on a Publishing site, you view the Most Popular Items report on your authoring site. Do the following:

1.  On your Authoring site, go to your catalog.
2.  Click the LIST tab –> Most Popular Items.

Most Popular Items icon

3.  On the Most Popular Items page, use the menu to select which usage event you want to view statistics for.

Select usage event

Note: You can view statistics for the Recommendations Displays usage event in the Popularity Trends report.

Change the Recent time period for a usage event
On the Most Popular Items page, there are two time periods: Recent and Ever.

Time periods for Most Popular Items report

The Ever time period shows statistics from the first day a usage event was recorded. The Recent time period is by default set to the last 14 days. To view the default settings of a usage event, do the following:

1.  On the server where SharePoint Server 2013 is installed, open the SharePoint 2013 Management Shell.

SharePoint 2013 Management Shell

2.  At the Windows PowerShell command prompt, type the following commands:

$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty)
$event = $tenantConfig.EventTypeDefinitions | where-object { $_.EventTypeId -eq <EventTypeId> }
$event

<EventTypeId> is the numeric EventTypeId of the usage event that you want to view. In the example below, I want to view the Views event, so I entered 1.

View RecentPopularityTimeframe property

The Recent time period is defined by the RecentPopularityTimeframe property. You can change the Recent time period to be anything between one and 14 days. To change the time period, do the following:

1.  In the SharePoint 2013 Management Shell, at the Windows PowerShell command prompt, type these commands:

$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty)
$event = $tenantConfig.EventTypeDefinitions | where-object { $_.EventTypeId -eq <EventTypeId> }
$event.RecentPopularityTimeFrame = <TimeFrame>
$tenantConfig.Update($SSP)

<EventTypeId> is the numeric EventTypeId of the usage event that you want to change, and <TimeFrame> is the new time period you want to set for the usage event.

In the example below, I wanted to change the Views Recent time to a week, so I entered 1 and 7.

Change ReceRecentPopularityTimeframe property

2.  To verify the change, at the Windows PowerShell command prompt, type the following command:

$event

RecentPopularityTimeframe parameter set to 7

Notice that the value for the RecentPopularityTimeframe parameter has changed to 7.

Narrow the Most Popular Items report to a specific attribute or category
Viewing usage reports per usage event is useful when you want to find out how visitors are interacting with your site. But many times you want to narrow the report to a specific attribute or category, for example all items that are on sale or all Laptops. To do this, you can use Keyword Query Language (KQL). If you don’t know KQL, don’t worry. You can easily narrow your Most Popular Items report without having much knowledge of KQL.

 In our Contoso catalog, we have a site column called RetOnSale. For each item, the value of RetOnSale specifies if the item is on sale or not.

RetOnSale site column

To narrow the Most Popular Items report to only show items that are on sale, we’ll use the managed property that represents the RetOnSale site column. In our Contoso scenario, this is RetOnSale (in another blog post I explain how you can find a managed property name).

In the Search Schema, we can see that the RetOnSale managed property is Queryable. This means that we can use it to narrow the Most Popular Items report.

RetOnSale queryable

To see Views usage event statistics for items that are on sale, on the Most Popular Items page, select Most Views, and enter RetOnSale=True.

Sort on RetOnSale value

And just like that, only items that are on sale are shown.

You can also narrow usage event statistics to a specific category, for example all Laptops. In our Contoso scenario, the Item Category site column is used to specify the category for each item.

Item Category site colulmn

The managed property name of the Item Category column is owstaxIdProductCatalogItemCategory. The owstaxIdProductCatalogItemCategory managed property is queryable, which means that we can use it to narrow the Most Popular Items report.

owstaxIdProductCatalogItemCategory is queryable

To see which laptops are viewed most by visitors, on the Most Popular Items page, select Most Views, and enter owstaxIdProductCatalogItemCategory:Laptops

Sort on owstaxIdProductCatalogItemCategory

By narrowing the Views usage event statistics to a specific category, we can verify that the Popular Items Web Part is working correctly on our publishing site. For example, on the Laptops page, notice that the three items that are displayed in the Popular Items Web Part are the same that are shown to have the most Views in the Most Popular Items report that we just narrowed to Laptops.

Verify  most Views

View the Popularity Trends report for an item
There are two ways you can access the Popularity Trends report for an item:

a.  On your catalog, select the item for which want to view the Popularity Trends report. In the ribbon, click ITEMS --> Popularity Trends.

Popularity Trends icon

b.  On the Most Popular Items page, click Popularity Trends.

Popularity trends link

Both of these options will open a Microsoft Excel sheet where you can view the daily and monthly statistics for the item. Each usage event is shown in a separate tab.

Popularity Trends report

About the TailTrimming parameter
While we’re on the subject of usage analytics reports, one usage event parameter that is worth mentioning is TailTrimming. This parameter specifies when the numbers that are shown in the usage analytics reports should be updated.

IMPORTANT: This parameter does not affect how recommendations are calculated.

For example, for the Views usage event the TailTrimming parameter is by default set to 3.

TailTrimming parameter is 3

This means that the usage analytics reports will be updated for an item when the item has been viewed a minimum three times within the last 24 hours. For example, if the item Fabrikam Laptop16 M6000 has been viewed twice within the last 24 hours, these two views won’t show up in the usage analytics reports. If within the next 24 hours the Fabrikam Laptop16 M6000 item is viewed 4 times, the usage analytics report will be updated with 4 views.

The reason the TailTrimming parameter is set to 3 is to avoid having to update items that almost none of your website visitors are interacting with. By not updating these items, you reduce the load on your system. On the other hand, when the TailTrimming parameter is set to 3, the usage analytics reports can be somewhat inaccurate. In the example with the Fabrikam Laptop16 M6000, the two views in the first 24 hours will not show up in the usage analytic reports. Total number of views of Fabrikam Laptop16 M6000 over the last 48 hours will show 4, but in reality, it was viewed 6 times.

If you want the usage analytics reports to be updated regardless of minimum amount of views within the last 24 hours, do the following:

1.  In the SharePoint 2013 Management Shell, at the Windows PowerShell command prompt, type these commands:

$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty)
$event = $tenantConfig.EventTypeDefinitions | where-object { $_.EventTypeId -eq <EventTypeId> }
$event.TailTrimming = <TailTrimming>
$tenantConfig.Update($SSP)

Where <EventTypeId> is the numeric EventTypeId of the usage event that you want to change, and <TailTrimming> is the minimum amount of times the usage event has to occur within 24 hours for the usage analytics reports to be updated.

In the example below I wanted the usage analytics reports for the Views usage event to be updated if a Views usage event occurs within 24 hours, so I entered 1 and 0.

Change TailTrimming parameter to 0

2.  To verify the change, at the Windows PowerShell command prompt, type the following command:

$event

Verify new TailTrimming parameter

Notice that the value of the TailTrimming parameter has changed to 0.


So with that, this series has come to an end. Hopefully you now have a better understanding of how recommendations and popular items work, and can start adding them to your website.