Open VladBern3 opened 4 years ago
Whilst the documentation is lacking, the module does work.
nuxt-amplitude
as a dev dependency with yarn
or npm
:yarn add nuxt-amplitude --dev
npm install nuxt-amplitude --dev
nuxt-amplitude
config to nuxt.config.js
:export default {
buildModules: [
[
'nuxt-amplitude',
{
apiKey: 'AMPLITUDE_KEY',
}
]
]
}
logEvent()
in your components mounted()
life cycle method:export default {
name: 'Index',
mounted () {
this.$amplitude.getInstance().logEvent('EVENT_NAME');
}
}
Hope that helps!
thanks - tried this but get an error.
Cannot read properties of undefined (reading '$amplitude'
I've added this to default.vue.
onMounted(() => {
this.$amplitude.getInstance().logEvent('EVENT_NAME');
});
Using cue with Composition API.
unusable module, nothing works, mute report