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

Multiple domain tracking

By default, the plugin will use the root level config object as the main configuration for the whole tracking system, but it is possible to include more domains to add for each event fired by simply adding an array of configurations

import { configure } from "vue-gtag";
import router from './router'

configure({
  tagId: "GA_MEASUREMENT_ID",
  additionalAccounts: [
    { tagId: 'GA_MEASUREMENT_ID_2' },
    { 
      tagId: 'GA_MEASUREMENT_ID_3',
      config: {
        'campaign_id': 'ABCD'
      }
    }
  ]
})

For example, this login event will be fired for all your domains: vue-gtag will inject the send_to parameter for you automatically.

import { event } from 'vue-gtag'

event('login', { method: 'Google' })

It is possible to override the send_to parameter at any time by just adding it to your event

PreviousPage trackerNextPlugin hooks

Last updated 1 month ago