Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Latest commit 9f9d7cf Apr 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist build... Apr 17, 2019
src Log complete URL when tracking page views and renam config variable Apr 17, 2019
.babelrc Initiale commit v1.0.1 Jul 5, 2017
.gitignore
LICENSE Initial commit Jul 5, 2017
README.md Log complete URL when tracking page views and renam config variable Apr 17, 2019
package-lock.json Added support for letting the AppInsights instance to be initialized … Apr 3, 2019
package.json change version Apr 18, 2019

README.md

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)

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
})
You can’t perform that action at this time.