vue-application-insights

73,815 24
Install
npm install vue-application-insights
Latest Version:1.0.7
License:MIT
Last Updated:Sep 23, 2023
Links: GitHub  ·  npm
Maintainer: dragon_

vue-application-insights

Installation

$ npm install vue-application-insights --save

Get started

import Vue from 'vue'
import VueAppInsights from 'vue-application-insights'

Vue.use(VueAppInsights, {
  id: 'XXXXXXXX--XXXX-XXXX-XXXXXXXXXXXX'
})

With vue router

import Vue from 'vue'
import router from './router'

import VueAppInsights from 'vue-application-insights'

Vue.use(VueAppInsights, {
  id: 'XXXXXXXX--XXXX-XXXX-XXXXXXXXXXXX',
  router
})

Example with custom track event

Vue.extend({

  methods: {
    custom_action() {
      this.$appInsights.trackEvent("custom_action", { value: 'ok' });
    }   
  }
  
});

Options

  • id - The instrumentation key of your AppInsights resource on Azure.
  • router - The router instance, which events should be tracked as page views (optional).
  • baseName String that will prefix the name of the tracked page (optional, default is '(Vue App)')
  • appInsights Instance of the Application Insights client (optional).
  • trackInitialPageView - Boolean that determines whether or not the initial page view should be tracked. (optional, defaults to true)
  • onAfterScriptLoaded Callback function that will be invoked after AppInsights script have loaded. (optional, defaults to undefined)
  • appInsightsConfig Object where you can put custom AppInsights configuration (optional, defaults to empty object)

Initializing AppInsights from outside the Vue application

Maybe you use server side code to include the javascript snippet that initializes AppInsights. In that case you want to provide the AppInsights instance to this Vue plugin and prevent it from tracking the initial page view.

import Vue from 'vue'
import router from './router'

import VueAppInsights from 'vue-application-insights'

Vue.use(VueAppInsights, {
  appInsights: window.appInsights,
  trackInitialPageView: false,
  router
})

Related Packages

vue3-application-insights

Package to work with application insights.

70,460 3
nuxt-otel-appinsights

Nuxt module to integrate OpenTelemetry (Azure Monitor) and Azure Application Ins...

3,161
@duffcloudservices/telemetry

Shared Azure Application Insights telemetry for DCS Vue sites — one App Insights...

2,031
vue

The progressive JavaScript framework for building modern web UI.

588,019,132 54,801
vue
@vueuse/shared
372,738,348 22,398

Version History

Version Released License
1.0.7 MIT
1.0.6 MIT
1.0.5 MIT
1.0.4 MIT
1.0.3 MIT