Last updated: Jun 07 2018

Area: Episerver Commerce, Episerver Perform Applies to versions: EPiServer.Personalization.Commerce 1.0 and higher

Activating widgets

The following are key concepts within Episerver Perform: 

  • TrackingTypes, which describe visitor actions that can be tracked.
  • Widgets, which describe how recommendations are calculated for a specific TrackingType.

When a new environment is set up, it has the following widgets. Note that widgets are only configured for five of the eleven TrackingTypes. See TrackingTypes for the full list.

Default widgets

In a new environment, all widgets are inactive. Before you can track and receive recommendations, you must activate them. To do this, use the WidgetService within EPiServer.Personalization.Commerce.

Sample code is provided in the SiteInitialization.cs file within the Commerce sample site source code. 

Simplified example

var widgetService = context.Locate.Advanced.GetInstance<WidgetService>();
var response = widgetService.GetWidgets();

foreach (var widget in response.EpiPerPage.Pages.SelectMany(x => x.Widgets))
{
   widget.Active = true;
   widgetService.UpdateWidget(widget);
}

Comments