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

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Deploy Tracking Script via CMS NuGet Package

Install and configure Content Recommendations tracking for Optimizely CMS 12 websites using the NuGet package integration.

Deploy Tracking Script via CMS NuGet Package

For Optimizely CMS 12 websites, you can set up tracking by installing a NuGet package.

Prerequisites

  • An active Content Recommendations subscription.
  • An Optimizely CMS 12 website.
  • Your site must use RenderRequiredClientResources in the HTML <head>, as this is where the tracking script is injected.

Step 1: Install the NuGet Package

  1. Add the Optimizely NuGet Feed:
    • In Visual Studio, go to Tools > NuGet Package Manager > Package Manager Settings.
    • Select Package Manager > Package Sources and click the Add (+) icon.
    • Enter a Name (e.g., Optimizely) and the Source URL: https://nuget.optimizely.com/feed/packages.svc/. Click OK.
  2. Install the Package:
    • In the Solution Explorer, right-click your project's Dependencies and select Manage NuGet Packages.
    • Select the Optimizely package source.
    • Browse for EPiServer.Personalization.Content.UI and click Install.
    • Rebuild your solution.

Step 2: Configure Tracking in appsettings.json

Add the following configuration block to the EPiServer section of your appsettings.json file. Populate the values with the credentials from your account.

{
  "EPiServer": {
    "ContentPersonalization": {
      "Environment": "your-region.idio.episerver.net",
      "ClientName": "your-client-name",
      "ClientId": "YOUR_CLIENT_ID",
      "ApiToken": "YOUR_API_TOKEN",
      "DisableDefaultTracking": false
    }
  }
}
KeyDescription
EnvironmentThe environment endpoint for your account.
ClientNameThe friendly name of your client account.
ClientIdThe alphanumeric client identifier for your account.
ApiTokenThe token used to authenticate to the API endpoint.
DisableDefaultTracking(Optional) Set to true to disable the default tracking script if you use another method like Google Tag Manager. This is critical to prevent duplicate tracking.

Step 3: Deploy and Validate

Deploy your updated application. To validate the installation, open your website, launch your browser's Developer Tools, and check the Network tab to confirm that requests are being sent to the Content Recommendations service (e.g., filter for idio).