vue-application-insights is a JavaScript plugin designed to integrate Microsoft Azure Application Insights telemetry into Vue.js 2 applications. It provides a straightforward `Vue.use()` interface for initialization, accepting an Azure Application Insights instrumentation key and optionally integrating with Vue Router for automatic page view tracking. The plugin exposes the Application Insights client instance as `$appInsights` on Vue components, enabling developers to easily track custom events, metrics, exceptions, and traces within their application logic. The package, currently at version 1.0.7, appears to be targeting Vue 2 exclusively, with its last significant update several years ago, indicating it is likely abandoned in favor of newer, Vue 3-compatible alternatives like `vue3-application-insights`. Its primary utility lies in simplifying the setup of the Application Insights JavaScript SDK within the Vue 2 ecosystem, abstracting away manual script loading and initialization.
npm install vue-application-insightsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up `vue-application-insights` with Vue Router for automatic page view tracking and how to trigger a custom event from a Vue component using `$appInsights`.
For Vue 3 projects, migrate to a compatible plugin like `vue3-application-insights` or integrate the `@microsoft/applicationinsights-web` SDK directly using Vue 3's plugin API.
Use environment variables (e.g., `process.env.VUE_APP_APPINSIGHTS_KEY` in Vue CLI projects) to inject the instrumentation key at build time, preventing direct hardcoding.
For new projects or if advanced features/latest SDK stability are required, consider direct integration with `@microsoft/applicationinsights-web` or use the actively maintained `vue3-application-insights` for Vue 3 projects.
Ensure `Vue.use(VueAppInsights, { id: 'YOUR_KEY' })` is called before your Vue application mounts and that the `id` option is provided with a valid Application Insights instrumentation key.Verify the `id` (instrumentation key) is correct. Check network requests in your browser's developer tools for calls to `dc.services.visualstudio.com` to confirm telemetry is being sent. Adjust sampling settings in your Application Insights resource if necessary.