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

Activating widgets

This topic describes widgets, website components used to present personalized product recommendations from Episerver Commerce.

About widgets

The following are key concepts within Episerver personalization: 

  • Tracking types, define visitor actions that can be tracked, see Tracking.
  • Widgets, displays recommendations based on tracking type calculations, see Personalization.

When a new environment is set up, it has the following Commerce-specific widgets. Note that widgets are only configured for five of the eleven tracking types, see TrackingTypes in the Commerce class library for the full list.

Default widgets

Activation

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

Sample code is provided in the SiteInitialization.cs file in the Episerver Commerce sample site source code, see Quicksilver on GitHub.

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);
}

Last updated: Jun 07, 2018

Feedback?