ngx-applications-insights
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

Angular Azure Insights

This is a basic angular wrapper implementation for the ApplicationInsights-JS package.

Getting started

a) Make sure you install ApplicationInsights-JS package

npm i @microsoft/applicationinsights-web

b) Install this package

npm i ngx-applications-insights

c) Import NgxApplicationInsightsModule to you app.module imports section

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    NgxApplicationInsightsModule.forRoot({
      enableAutoRouteTracking: true, // enable route navigation tracking, the default valuefor this is false.
      instrumentationKey: 'Your Instrumentation Key From Azure here',
    }),
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}
  1. Inject NgxApplicationInsightsService to user component / service etc.
import { Component, OnInit } from '@angular/core';
import { NgxApplicationInsightsService } from 'ngx-applications-insights';

@Component({
  selector: 'app-example',
  templateUrl: './test-a.component.html',
  styleUrls: ['./test-a.component.scss'],
})
export class ExampleComponent implements OnInit {
  constructor(private insights: NgxApplicationInsightsService) {}

  ngOnInit(): void {
   console.log('Called track event');
    this.insights.trackEvent({
      name: 'Test event a',
      properties: { A: 12 },
    });
  }
}

Package Sidebar

Install

npm i ngx-applications-insights

Weekly Downloads

1

Version

1.1.4

License

The Unlicense

Unpacked Size

55.1 kB

Total Files

20

Last publish

Collaborators

  • danielszusty