npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng2-appinsights

v1.0.0-beta.1

Published

App Insights module for Angular 2.0.x

Downloads

270

Readme

ng2-appinsights

Installation

npm install ng2-appinsights --save

Usage

Initialization

Inside your app module import AppInsightsModule

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppInsightsModule } from 'ng2-appinsights';

import { AppComponent } from './app.component';

@NgModule({
    imports : [
        BrowserModule,
        AppInsightsModule,
    ],
    declarations : [AppComponent],
    bootstrap : [AppComponent]
})
export class AppModule {
}

Inside your app component initialize the AppInsightsService

import { Component } from '@angular/core';
import { AppInsightsService } from 'ng2-appinsights';

@Component({
    selector: 'app',
    templateUrl: './app.component.html'
})
export class AppComponent {
    constructor(private appinsightsService: AppInsightsService) {
        this.appinsightsService.Init({
            instrumentationKey: '<INSTRUMENTATION_KEY>'
        });
    }
}

Configurations

To configure the service pass a configuration object in the Init method

this.appinsightsService.Init({
    instrumentationKey: '<INSTRUMENTATION_KEY>', // Required field
    enableDebug: false,
    maxAjaxCallsPerView: 50,
    disableTelemetry: true
});

The complete list of configuration options are

instrumentationKey;

The key of your Application Insights resource in Azure

endpointUrl: string;

The Application Insights server

accountId: string;

User Account Id

sessionRenewalMs: number;

A session is logged if the user is inactive for this time in milliseconds. Default 30 mins.

sessionExpirationMs: number;

A session is logged if it has continued for this time in milliseconds. Default 24h.

maxBatchSizeInBytes: number;

Default 100k

maxBatchInterval: number;

Default 15s

enableDebug: boolean;

If true, data is sent immediately and not batched.

disableTelemetry: boolean;

If true, telemetry data is not collected or sent. Default false.

verboseLogging: boolean;

Default false

samplingPercentage: boolean;

Controls what percentage of events will be sent Default 100.

diagnosticLogInterval: number;

Default 10s

disableExceptionTracking: boolean;

If true, exceptions are not monitored.

disableAjaxTracking: boolean;

If true, ajax calls are not monitored.

overridePageViewDuration: boolean;

If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called. If false and no custom duration is provided to trackPageView, the page view performance is calculated using the navigation timing API.

maxAjaxCallsPerView: number;

Default 500 - controls how many ajax calls will be monitored per page view. Set to -1 to monitor all ajax calls on the page.

isCookieUseDisabled: boolean;

If true, the SDK will not store or read any data from cookies. Default: false

cookieDomain: string;

Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.

disableFlushOnBeforeUnload: boolean;

Default false. If true, flush method will not be called when onBeforeUnload event triggers.

enableSessionStorageBuffer: boolean;

If true, the buffer with all unsent telemetry is stored in a session storage. The buffer is resotered on page load. The feature is enable by default starting with v0.23.0.

isRetryDisabled: boolean;

Is retry handler disabled. Default false. If enabled, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error) and 503 (service unavailable).

url: string;

The url from where the JS SDK will be downloaded. Default 'https://az416426.vo.msecnd.net/scripts/a/ai.0.js'

isStorageUseDisabled: boolean;

If true, the SDK will not store or read any data from local and session storage. Default: false

API Reference

Check Microsoft Application Insights API Reference for API reference

Check e2e/app/app.component.ts for examples