Global namespace

With gtag.js it's possible to customize the name of your global gtag instance to avoid conflicting with already installed library instances in your application.

import Vue from "vue";
import VueGtag from "vue-gtag";

Vue.use(VueGtag, {
  config: { id: "UA-1234567-1" },
  globalObjectName: 'foo'
});

From now on the plugin will start using the instance name specified in the options, but you will still be able to use this.$gtag inside your Vue project without any changes.

Last updated