vue-gtag
Github
v2
v2
  • Get started
  • Migration v1 to v2
  • 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

Opt-in/out

#GDPR

PreviousAPINextGlobal namespace

Last updated 4 years ago

The plugin will immediately start tracking, but it is possible to disable the plugin at the start and enable it later on, maybe after a cookie banner.

import { createApp } from "vue";
import App from "./App.vue";
import VueGtag from "vue-gtag";

createApp(App).use(VueGtag, {
  config: { id: "GA_MEASUREMENT_ID" },
  enabled: false
}).mount("#app");

The gtag.js documentation says that it is possible to download the script if the script is disabled and it won't go against policy rules.

In case you might want to go a little more advanced, you could still opt for the solution.

custom bootstrap