Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unusable #2

Open
VladBern3 opened this issue Feb 18, 2020 · 2 comments
Open

unusable #2

VladBern3 opened this issue Feb 18, 2020 · 2 comments

Comments

@VladBern3
Copy link

unusable module, nothing works, mute report

@mikedidthis
Copy link

mikedidthis commented Feb 19, 2020

Whilst the documentation is lacking, the module does work.

  1. Add nuxt-amplitude as a dev dependency with yarn or npm:
yarn add nuxt-amplitude --dev
npm install nuxt-amplitude --dev
  1. Add nuxt-amplitude config to nuxt.config.js:
export default {
  buildModules: [
    [
      'nuxt-amplitude',
      {
        apiKey: 'AMPLITUDE_KEY',
      }
    ]
  ]
}
  1. Call logEvent() in your components mounted() life cycle method:
export default {
  name: 'Index',
  mounted () {
    this.$amplitude.getInstance().logEvent('EVENT_NAME');
  }
}

Hope that helps!

@dcrabbeYapily
Copy link

dcrabbeYapily commented Oct 27, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants