1.4.5 • Published 5 years ago
applicationinsightsfornuxt v1.4.5
applicationinsightsfornuxt
ApplicationInsights module for Nuxt.js
Features
The module enables event logging through Application Insights.
Setup
- Add
applicationinsightsfornuxtdependency using npm to your project - Add
applicationinsightsfornuxttomodulessection ofnuxt.config.js
{
modules: [
'applicationinsightsfornuxt',
],
appInsights: {
instrumentationKey: '' // your project's Instrumentation Key here
}
}Nuxt compatibility
Versions of NuxtJS before v2.4.0 are not supported by this package.
Usage
Enter your Instrumentation Key in the NuxtJS config file. Additional config settings can be found server and client.
Usage in Vue component
In a Vue component, Application Insights is available as this.$appInsights, so we can call functions like
this.$appInsights.trackTrace({message: 'This message will use a telemetry initializer'})where this is a Vue instance.
Options
Options can be passed using either environment variables or appInsights section in nuxt.config.js.
Normally setting required Instrumentation Key information would be enough.
instrumentationKey
- Type:
String- Default:
process.env.APPINSIGHTS_INSTRUMENTATION_KEY || false - If no
instrumentationKeyis provided module wont work
- Default:
disabled
- Type:
Boolean- Default:
process.env.APPINSIGHTS_DISABLED || false - ApplicationInsights will not be initialised if set to
true.
- Default:
disableClientSide
- Type:
Boolean- Default:
process.env.APPINSIGHTS_DISABLE_CLIENT_SIDE || false
- Default:
disableServerSide
- Type:
Boolean- Default:
process.env.APPINSIGHTS_DISABLE_SERVER_SIDE || false
- Default:
initialize
- Type:
Boolean- Default:
process.env.APPINSIGHTS_INITIALIZE || true
- Default:
trackPageView
- Type:
Boolean- Default:
process.env.APPINSIGHTS_TRACK_PAGE_VIEW || true
- Default:
serverConfig
- Type:
Object- Default:
{ } - If specified, values will override config values for server Application Insights plugin
- Default:
clientConfig
- Type:
Object- Default:
{ } - If specified, values will override config values for client Application Insights plugin
- Default:
License
This module has been based on: https://github.com/nuxt-community/applicationinsights-module And adapted to meet the needs of my projects.