Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide
GitHubNuGetDev CommunityOptimizely AcademySubmit a ticket

Optimizely developer documentation

How can we help you?

Try our conversational search powered by Generative AI!

AI OnAI Off

Activate widgets

Describes how to activate widgets and website components used to present personalized product recommendations from Optimizely Customized Commerce.

The following are key concepts within Optimizely Recommendations:

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

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 Optimizely Customized Commerce sample site source code. See Quicksilver on GitHub.

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

Did this page help you?