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

How to use google-gtag with typescript? #42

Open
mogmet opened this issue Oct 6, 2020 · 1 comment
Open

How to use google-gtag with typescript? #42

mogmet opened this issue Oct 6, 2020 · 1 comment

Comments

@mogmet
Copy link

mogmet commented Oct 6, 2020

Hi!
I want to use google-gtag in the Nuxt(with vuex-module-decorators) + Typescript.

I read #8 issue.
But I can't understand how to use.

Please tell me how to use google-gtag with Typescript.

@mogmet mogmet changed the title How use google-gtag with typescript? How to use google-gtag with typescript? Oct 6, 2020
@FlorianWoelki
Copy link

If anyone wants a valid (for now) TS solution:

Add a google-gtag.d.ts file with the following content:

import Vue from 'vue';

declare module 'vue/types/vue' {
  interface Vue {
    $gtag: Function;
  }
}

You can now use this.$gtag in your vue components.

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

2 participants