All Projects → TrilonIO → Angular Application Insights

TrilonIO / Angular Application Insights

Licence: mit
Angular & Azure Application Insights module - Find out performance and usage of your app by connecting Microsoft Azure Application insights with your Angular application by @TrilonIO

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Angular Application Insights

Angulartics2
Vendor-agnostic analytics for Angular2 applications.
Stars: ✭ 963 (+670.4%)
Mutual labels:  application-insights, angular2, angular5
Springbootangularhtml5
♨️ Spring Boot 2 + Angular 11 + HTML5 router mode + HTTP interceptor + Lazy loaded modules
Stars: ✭ 89 (-28.8%)
Mutual labels:  angular2, angular5
Angular Seed
Angular Seed App with Angular 5.0, ngrx/store 4, bootstrap 4, ngrx/effects, immutable.js
Stars: ✭ 87 (-30.4%)
Mutual labels:  angular2, angular5
Azure K8s Metrics Adapter
An implementation of the Kubernetes Custom Metrics API and External Metrics API for Azure Services
Stars: ✭ 97 (-22.4%)
Mutual labels:  azure, application-insights
Ng Simple Slideshow
A simple, responsive slideshow for Angular 4+.
Stars: ✭ 119 (-4.8%)
Mutual labels:  angular2, angular5
Angular2
Angular 2 Seed
Stars: ✭ 75 (-40%)
Mutual labels:  angular2, angular5
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-26.4%)
Mutual labels:  angular2, angular5
Angular Tree Component
A simple yet powerful tree component for Angular (>=2)
Stars: ✭ 1,031 (+724.8%)
Mutual labels:  angular2, angular5
Applicationinsights Dotnet Logging
.NET Logging adaptors
Stars: ✭ 100 (-20%)
Mutual labels:  azure, application-insights
Angular Admin Lte
AdminLte for Angular 2
Stars: ✭ 109 (-12.8%)
Mutual labels:  angular2, angular5
Aspnetcore Angular Universal
ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
Stars: ✭ 1,455 (+1064%)
Mutual labels:  angular2, angular5
Drip Ionic3
「水滴打卡」App Open Source Code Base On Ionic V3 Framework
Stars: ✭ 74 (-40.8%)
Mutual labels:  angular2, angular5
Ng2 Breadcrumbs
A breadcrumb service for the Angular 7 router
Stars: ✭ 61 (-51.2%)
Mutual labels:  angular2, angular5
Ngx Papaparse
Papa Parse wrapper for Angular
Stars: ✭ 83 (-33.6%)
Mutual labels:  angular2, angular5
Azuremonitoringhackathon
Operationalize Azure deployments with Azure platform tools​
Stars: ✭ 46 (-63.2%)
Mutual labels:  azure, application-insights
Ng2 Flatpickr
Angular 2+ wrapper for flatpickr (https://github.com/chmln/flatpickr)
Stars: ✭ 91 (-27.2%)
Mutual labels:  angular2, angular5
Applicationinsights Go
Microsoft Application Insights SDK for Go
Stars: ✭ 113 (-9.6%)
Mutual labels:  azure, application-insights
Ng2 Pdf Viewer
📄 PDF Viewer Component for Angular 5+
Stars: ✭ 997 (+697.6%)
Mutual labels:  angular2, angular5
Applicationinsights Php
Azure Application Insights SDK for PHP
Stars: ✭ 98 (-21.6%)
Mutual labels:  azure, application-insights
Serverless Url Shortener
Azure Function for a URL shortening website. Uses serverless functions, Azure Table Storage and Application Insights.
Stars: ✭ 113 (-9.6%)
Mutual labels:  azure, application-insights

Angular Azure Application Insights implementation

Connect your Angular client-side to Microsofts Application Insights with this easy-to-use Module.

Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms. Use it to monitor your live web application. It will automatically detect performance anomalies. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app.

npm Minzipped Size NPM Downloads MIT License


Trilon.io - Angular Universal, NestJS, JavaScript Application Consulting Development and Training

Made with ❤️ by Trilon.io


Installation

Install & save the library to your package.json:

$ npm i -S @markpieszak/ng-application-insights

AppModule Setup

Now add ApplicationInsightsModule to your Angular Root AppModule:

// 1) Import the Application Insights module and the service provider
import { ApplicationInsightsModule, AppInsightsService } from '@markpieszak/ng-application-insights';

@NgModule({
  imports: [
    // 2) Add the Module to your imports
    ApplicationInsightsModule.forRoot({
      instrumentationKey: 'Your-Application-Insights-instrumentationKey'
    })
  ],
  providers: [ 
     // 3) Add AppInsightsService to your providers list
     AppInsightsService
  ]
})
export class YourRootModule { }

What if you don't know your instrumentationKey right away?

// Use instrumentationKeySetLater
ApplicationInsightsModule.forRoot({
  instrumentationKeySetLater: true // <--
})

// Then later in your Application somewhere
constructor(
  private appInsightsService: AppInsightsService
) {
  appInsightsService.config = {
    instrumentationKey: __env.APPINSIGHTS_INSTRUMENTATIONKEY // <-- set it later sometime
  }
  // then make sure to initialize and start-up app insights
  appInsightsService.init();
}

Usage

Through out your application you can now use the AppInsightsService class to fire off AppInsights functionality.

import { AppInsightsService } from '@markpieszak/ng-application-insights';

export class ShoppingCartComponent {
  public cart: [];
  constructor(private appInsightsService: AppInsightsService) {}

  saveCart(user) {
    // MOCK Example of sending a trackEvent()
    // Saving some sample user & cart product data
    this.appInsightsService.trackEvent('ShoppingCart Saved', { 'user': user.id, 'cart': cart.id });
  }
}

Usage with Aspnetcore-Angular2-Universal repo or JavaScriptServices ( apps w/ Server-side rendering )

ie: https://github.com/TrilonIO/aspnetcore-angular-universal

First, make sure you are only importing the library & the server within the browser-app.module NgModule (do not share it within a common one, as the server isn't able to use this library during it's server-renders).

Secondly, make sure you are calling the injector to get AppInsightsService during ngOnInit:

export class HomeComponent implements OnInit {

    private AIService: AppInsightsService;
    private isBrowser: boolean;

    constructor(@Inject(PLATFORM_ID) private platformId, private injector: Injector) {
        this.isBrowser = isPlatformBrowser(this.platformId);
    }

    ngOnInit() { // <-- 
        if (this.isBrowser) { // <-- only run if isBrowser
            this.AIService = <AppInsightsService>this.injector.get(AppInsightsService); // <-- using the Injector, get the Service
            this.AIService.trackEvent('Testing', { 'user': 'me' });
        } 
    }
}

API

You can see a list of the API here: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#class-appinsights

AppInsightsService.trackEvent()
AppInsightsService.startTrackEvent()
AppInsightsService.stopTrackEvent()
AppInsightsService.trackPageView()
AppInsightsService.startTrackPage()
AppInsightsService.stopTrackPage()
AppInsightsService.trackMetric()
AppInsightsService.trackException()
AppInsightsService.trackTrace()
AppInsightsService.trackDependency()
AppInsightsService.flush()
AppInsightsService.setAuthenticatedUserContext()
AppInsightsService.clearAuthenticatedUserContext()

How to Contribute?

ng-Application-Insights Development

To generate all *.js, *.js.map and *.d.ts files:

npm run build

To lint all *.ts files:

npm run lint

License

MIT License

Copyright (c) 2016-2020 Mark Pieszak

Twitter Follow


Trilon - JavaScript, ASP.NET, Node, NestJS - Consulting | Training | Development

Check out Trilon.io for more info!

Contact us at [email protected], and let's talk about your projects needs.

Trilon.io - Angular Universal, NestJS, JavaScript Application Consulting Development and Training

Follow Trilon online:

Twitter: @Trilon_io

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].