vue-gtag
Github
v1
v1
  • Get started
  • Bootstrap options
  • Auto tracking
  • Multiple domain tracking
  • Plugin hooks
  • API
  • Opt-in/out
  • Global namespace
  • Access gtag instance directly
  • Debug
  • Plugin options
  • Methods
    • pageview
    • event
    • screenview
    • customMap
    • purchase
    • linker
    • set
    • time
    • config
    • exception
Powered by GitBook
On this page

Access gtag instance directly

I try to make all method a bit simpler so you don't need extra boilerplate, but gtag api is quite vast, so in case you didn't find what you were looking for, you can use the query method: it's like using gtag itself.

export default {
  name: 'MyComponent',

  methods: {
    track () {
      this.$gtag.query('event', 'screen_view', {
        app_name: 'MyApp',
        screen_name: 'Home page',
      })
    }
  }
}
PreviousGlobal namespaceNextDebug

Last updated 5 years ago