microsoft-applicationinsights-angular5
This is a wrapper library for Angular 5+ modules over Microsoft Application Insights SDK.
Working example at https://github.com/manishrasrani/microsoft-applicationinsights-angular5-example
Application Insights is an Azure service for monitoring web applications. It includes analytics tools to help you understand application usage and to diagnose issues with the goal of continuously improving performance and usability. To read more on ApplicationInsights, refer here.
Consumption of the library
Step 1: Install the package
npm i microsoft-applicationinsights-angular5
Also add it to your dependencies section in package.json so that it is restored when you do an npm install.
Step 2: Import the AppInsights module
In the root mosule of your application, do import the AppInsights module.
import
Add it to the imports array in your root module by providing the Instrumentation Key of the AppInsights resource where you want to log the insights.
@NgModuleexport class AppModule
Step 3: Consuming the library in your application
Wherever you do want to consume the library, just import the AppInsightsService and inject it in your constructor.
import
Send telemetry data to AppInsights as shown below -
this.logger.logTrace;this.logger.logEvent;this.logger.logPageView;this.logger.logException;
Additional properties to the above methods can also be set if required. Example -
this.logger.logEvent;
With these steps your application should be up and running with Application Insights.