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
RenderRequiredClientResourcesin the HTML<head>, as this is where the tracking script is injected.
Install the NuGet package
Add the Optimizely NuGet feed
- Open 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 URLhttps://nuget.optimizely.com/feed/packages.svc/. - Click OK.
Install the Package
- Go to Solution Explorer.
- Select Dependencies from Manage NuGet Packages drop-down list.
- Select the Optimizely package source.
- Browse for
EPiServer.Personalization.Content.UIand click Install. - Rebuild your solution.
Configure tracking in appsettings.json
appsettings.jsonAdd 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 totrueto 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).
Updated 8 days ago
