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

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

Deploy tracking script with CMS NuGet package

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

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

Prerequisites

  • Have an active Content Recommendations subscription.
  • Have an Optimizely CMS 12 website.
  • Use RenderRequiredClientResources in the HTML <head>, as this is where the tracking script is injected.

Install the NuGet package

Add the Optimizely NuGet feed

  1. Open Visual Studio.
  2. Go to Tools > NuGet Package Manager > Package Manager Settings.
  3. Select Package Manager > Package Sources and click the Add (+) icon.
  4. Enter a Name (e.g., Optimizely) and the Source URL https://nuget.optimizely.com/feed/packages.svc/.
  5. Click OK.

Install the Package

  1. Go to Solution Explorer.
  2. Select Dependencies from Manage NuGet Packages drop-down list.
  3. Select the Optimizely package source.
  4. Browse for EPiServer.Personalization.Content.UI and click Install.
  5. Rebuild your solution.

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
    }
  }
}
  • Environment – The environment endpoint for your account.
  • ClientName – The friendly name of your client account.
  • ClientId – The alphanumeric client identifier for your account.
  • ApiToken – The token used to authenticate to the API endpoint.
  • DisableDefaultTracking – (Optional) Used to disable the default tracking script if you use another method like Google Tag Manager. Set to true to prevent duplicate tracking.

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 (for example, filter for idio).