ApplicationInsights module for Nuxt 2
The module enables event logging through Application Insights.
- Add
@nuxtjs/applicationinsights
dependency using yarn or npm to your project - Add
@nuxtjs/applicationinsights
tomodules
section ofnuxt.config.js
{
modules: [
'@nuxtjs/applicationinsights',
],
appInsights: {
instrumentationKey: '' // your project's Instrumentation Key here
}
}
Versions of NuxtJS before v2.4.0 are not supported by this package.
Enter your Instrumentation Key in the NuxtJS config file. Additional config settings can be found server and client.
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 can be passed using either environment variables or appInsights
section in nuxt.config.js
.
Normally setting required Instrumentation Key information would be enough.
- Type:
String
- Default:
process.env.APPINSIGHTS_INSTRUMENTATION_KEY || false
- If no
instrumentationKey
is provided module wont work
- Default:
- Type:
String
- Default:
process.env.APPINSIGHTS_CONNECTION_STRING || false
- If no
serverConnectionString
is provided server side wont work
- Default:
- Type:
Boolean
- Default:
process.env.APPINSIGHTS_DISABLED || false
- ApplicationInsights will not be initialised if set to
true
.
- Default:
- Type:
Boolean
- Default:
process.env.APPINSIGHTS_DISABLE_CLIENT_SIDE || false
- Default:
- Type:
Boolean
- Default:
process.env.APPINSIGHTS_DISABLE_SERVER_SIDE || false
- Default:
- Type:
Boolean
- Default:
process.env.APPINSIGHTS_INITIALIZE || true
- Default:
- Type:
Boolean
- Default:
process.env.APPINSIGHTS_TRACK_PAGE_VIEW || true
- Default:
- Type:
Object
- Default:
{ }
- If specified, values will override config values for server Application Insights plugin
- Default:
- Type:
Object
- Default:
{ }
- If specified, values will override config values for client Application Insights plugin
- Default:
Copyright (c) Dmitry Molotkov aldarund@gmail.com