Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controlling Application Insights javascript injection

The Application Insights extensions in Visual Studio and Azure appear to inject the javascript snippet for page view tracking automatically, even though the docs say you enable this with an Application Setting key "APPINSIGHTS_JAVASCRIPT_ENABLED" = true.

Other docs show how to add the same javascript in my layout view, which I did. As a result I'm now seeing the AI javascript twice, once from my view, once from the AI magic. I'd prefer to control this myself -- how can I prevent the tooling from modifying the pages to inject the script? Setting APPINSIGHTS_JAVASCRIPT_ENABLED to false doesn't seem to work.

I'm working in an ASP.NET Core 2.0 web application.

like image 205
Noah Stahl Avatar asked Dec 06 '17 19:12

Noah Stahl


1 Answers

Try upgrading to the lastest version of Microsoft.ApplicationInsights.AspNetCore. They released a new version (2.2.0) today, which resolved the problem for me! The javascript part is not added automatically anymore!

like image 52
Roel Hendrickx Avatar answered Sep 19 '22 13:09

Roel Hendrickx