vue-gtag
Github
v3
v3
  • Get started
  • gtag.js consent management
  • Page tracker
  • Multiple domain tracking
  • Plugin hooks
  • Global namespace
  • Access gtag instance directly
  • Plugin options
  • Migration v2 to v3
  • Methods
    • pageview
    • event
    • consent
    • consentGrantedAll
    • consentDeniedAll
    • query
    • screenview
    • customMap
    • ecommerce
    • linker
    • set
    • time
    • config
    • exception
Powered by GitBook
On this page

Access gtag instance directly

The plugin provides a list of methods that help you write less code. For example, the "customMap" method

import { customMap } from 'vue-gtag'

customMap({ key: 'value' })    

This internally will fire the following

window.gtag('config', 'GA_MEASUREMENT_ID', {
   custom_map: { key: 'value' }
})

The gtag.js library includes numerous events and configurations. In cases not covered, it is possible to use the "query" method that provides access to the gtag instance.

import { query } from 'vue-gtag'

query('config', 'GA_MEASUREMENT_ID', {
   custom_map: { key: 'value' }
})  
PreviousGlobal namespaceNextPlugin options

Last updated 1 month ago