In SharePoint Server 2013, recommendations and popular items can be displayed because a feature called Usage analytics tracks and analyzes how visitors interact with your website. You can use the results that Usage analytics produces to add content to your website, for example “People who viewed this item also viewed” or “Popular items in this category.”
Here’s how Usage analytics works:
- Visitors do something on your website, for example, they view an item. This generates a usage event.
- The usage event is recorded in the Event store.
- The usage events are sent to the Analytics Processing Component where they are analyzed. The result is sent to the Search index.
- When visitors navigate to a page that contains a Recommendations or Popular Items Web Part, a query is automatically issued and sent to the search index.
- The query results are returned from the search index and displayed in the Recommendations and Popular Items Web Part on your website.
View the usage event definitions
There are three default usage events in SharePoint Server 2013:
- Views – a usage event is registered when a visitor views an item on your site.
- Recommendation Displayed – a usage event is registered when an item is displayed as a recommendation on your site.
- Recommendation Clicked – a usage event is registered when a visitor clicks an item that is displayed as a recommendation on your site.
2. At the Windows PowerShell command prompt, type the following commands:
$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$SSP.GetAnalyticsEventTypeDefinitions([Guid]::Empty, 3) | ft
The default usage event definitions are displayed. I’ll explain some of the usage event settings in later blog posts, but for now, just notice that each event has an EventTypeId and an EventName.
The default usage events have the following EventTypeID values:
About Usage analytics in a cross-site publishing scenario
One important step in how Usage analytics works is step 2: The usage event is recorded in the Event store. In the Event store, each usage event must be recorded using the URL of the item. I’ll repeat this, because this is really important:
In the Event store, each usage event must be recorded using the URL of the item.
This is especially important in a cross-site publishing scenario. With cross-site publishing, content is stored in an Authoring site collection and displayed in a Publishing site collection. Managed navigation is used together with category pages and catalog item pages to display content. This means that when visitors view an item on the Publishing site, the usage event takes place on the catalog item page, for example http://www.contoso/sites/Pages/ContosoItemPage.aspx. Because the same catalog item page is used to display many items, the usage event can’t be recorded using the URL of the catalog item page. For Usage analytics to work in a cross-site publishing scenario, the usage event must be recorded using the URL of the item in the Authoring site collection, for example: http://www.contoso/sites/catalog/Lists/Products/DispForm.aspx?ID=12.
Depending on how you’ve set up your website, SharePoint Server 2013 can automatically record the usage event on the URL of the item in the Authoring site. Here’s the question you have to ask yourself: Which Web Part are you using to display items on your catalog item page? If your answer is “Catalog Item Reuse Web Parts”, then you have nothing to worry about. The Catalog Item Reuse Web Part will automatically ensure that usage events are recorded correctly in the Event store. However, if you’re using a Content Search Web Part to display items on your catalog item page, you’ll have to do some extra configuration steps. But not to worry: I’ll explain all these steps in the next blog articles.
But before we move on, there’s one more thing that you need to know about: The UsageAnalyticsID managed property.
About the UsageAnalyticsID managed property
The items on our Contoso website are available in different colors. For example, the item Southridge Video Laptop15.4W M1548 is available in four different colors. On the Authoring site, color versions are grouped under a common Group Number.
On the Publishing site, we use the value of both Group Number and Item Number in the friendly URL (FURL). Visitors can easily see that the product exists in other colors, and they can quickly view details about the product in another color without having to go back to the category page.
The default Usage analytics calculation will consider the color of the items when calculating recommendations. For example, recommendations for a white Southridge Video Laptop15.4W M1548 could turn out to be a white Litware Laptop Keyboard X105, a blue Litware Laptop Keyboard X105, a white Litware Wireless Laser Mouse M55 and a blue Litware Wireless Laser Mouse M55.
The two recommended keyboards are the same product, and so are the two mice. These are not good recommendations. To get recommendations that will ignore the product color, we have to change the mapping of the UsageAnalyticsID managed property.
By default, UsageAnalyticsID is mapped to the crawled property ows_ProductCatalogItemNumber. If you used the Product Catalog site template when you created your Authoring site collection, this crawled property represents the site column Item Number in your Products list.
If you didn’t use the Product Catalog site template when you created your Authoring site collection, or, if you don’t want to use the site column Item Number in the Usage analytics calculation, you’ll have to change the mapping of the UsageAnalyticsID managed property. However, when you change the mapping, you’ll have to make sure that the property you map to UsageAnalyticsID is used in the friendly URL (FURL) of your catalog item page (most likely, you specified this FURL when you connected your publishing site to your catalog). This is because the Recommended Items Web Part uses a value from the FURL to show the correct recommendations (I will show you how to configure the Recommended Items Web Part in a later blog post).
Remember, the color versions of our products are grouped under a common Group Number, and we use the value of Group Number in the FURL of our catalog item page. So, by mapping UsageAnalyticsID to the crawled property of Group Number, the Usage analytics calculation will be done on a group level. This means that we can display one product per product group as recommendations.
There is of course more to it than this, so if you’re confused, I hope you’ll hang in there. In the next blog posts, I’ll walk you through all the steps that you have to do to display recommendations and popular items on your website.
Next blog post in this series:
Modify the Content Search Web Part display template and use Windows PowerShell to start Usage analytics