![](https://camo.githubusercontent.com/5af1ba69cba1335562249d304591600675c0245198f438fc80dd4aa21d710530/68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f64742f536f656e6e656b65722e426c617a6f722e4170706c69636174696f6e496e7369676874732e7376673f7374796c653d666f722d7468652d6261646765)
Soenneker.Blazor.ApplicationInsights
dotnet add package Soenneker.Blazor.ApplicationInsights
- Register the interop within DI (
Program.cs
)
public static async Task Main(string[] args)
{
...
builder.Services.AddApplicationInsights();
}
- Inject
IApplicationInsightsInterop
within your App.Razor
file
@using Soenneker.Blazor.ApplicationInsights.Abstract
@inject IApplicationInsightsInterop AppInsightsInterop
- Initialize the interop in
OnInitializedAsync
within App.Razor
using your Application Insights connection string
protected override async Task OnInitializedAsync()
{
await AppInsightsInterop.Init("your-connection-string-here");
...
}