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

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

Add AppInsights in .NET

How to implement AppInsights in the .NET backend for Optimizely Configured Commerce.

Prerequisites

  • Optimizely Configured Commerce 5.4.2412 or later.
  • Application Insights Connection String

    📘

    Note

    Optimizely does not provide the Application Insights Connection String. You or your partner must provide them.

Implement Application Insights

You can add the Application Insights connection string at System > Developer > Application Insights Connection String.

You must restart the site when adding or changing the connection string.

📘

Note

This setting is only available for ISC_System and ISC_Implementer user roles.

Customize Application Insights

Below are some ways to customize Application Insights. See Microsoft's documentation for what else you can do.

Use Extensions to customize data

Your Extensions.dll can define any number of ITelemetryInitializer classes. You can use them to customize data such as RoleName and RoleInstance.

public class CustomTelemetryInitializer : ITelemetryInitializer
{
    public void Initialize(ITelemetry telemetry)
    {
        telemetry.Context.Cloud.RoleName = "CustomRole";
        telemetry.Context.Cloud.RoleInstance = "CustomInstance";
    }
} 

See Enable a framework extension for Application Insights JavaScript SDK. For Spire, partners can implement as much of this as needed.

Ensure to match environment keys with C# code. This can be swapped with the JS build constant IS_PRODUCTION to change keys. See Microsoft's applicationinsights-react-js repository for information.

Configure availability

You can configure availability in Application Insights. See Microsoft's documentation on availability tests.