Application insights for vue.js. Add custom property to every log in application insights from one place
npm install vue-app-insightsconsole
$ npm install vue-app-insights --save
`
Get started
Use app-insights without router
`js
import Vue from "vue";
import VueAppInsights from "vue-app-insights";
Vue.use(VueAppInsights, {
id: "XXXXXXXX--XXXX-XXXX-XXXXXXXXXXXX"
});
`
Use app-insights with router
`js
import Vue from "vue";
import router from "./router";
import VueAppInsights from "vue-app-insights";
Vue.use(VueAppInsights, {
id: "XXXXXXXX--XXXX-XXXX-XXXXXXXXXXXX",
router
});
`
Use app-insights to track custom events
`js
this.$appInsights.trackEvent(name: string, properties?: {[string]:string}, measurements?: {[string]:number})
`
Use app-insights to track exception
`js
this.$appInsights.trackException(exception: Error, handledAt?: string, properties?: {[string]:string}, measurements?: {[string]:number}, severityLevel?: AI.SeverityLevel)
`
Use app-insights to track metrics
`js
this.$appInsights.trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {[string]:string})
`
Use app-insights to track trace
`js
this.$appInsights.trackTrace(message: string, properties?: {[string]:string}, severityLevel?: AI.SeverityLevel)
`
Use app-insights to track dependancy
`js
this.$appInsights.trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) {
`
Use app-insights to add custom properties
`js
import Vue from "vue";
import router from "./router";
import VueAppInsights from "vue-app-insights";
Vue.use(VueAppInsights, {
id: "XXXXXXXX--XXXX-XXXX-XXXXXXXXXXXX",
router,
property: { "custom property": "custom value" }
});
`
Use app-insights to add configuration
`js
import Vue from "vue";
import router from "./router";
import VueAppInsights from "vue-app-insights";
Vue.use(VueAppInsights, {
id: "XXXXXXXX--XXXX-XXXX-XXXXXXXXXXXX",
router,
property: { "custom property": "custom value" },
IConfig: {
disableTelemetry: false,
disableAjaxTracking: true
}
});
``