API

You can access several methods from inside the $gtag instance in your component scope

  • query

  • config

  • event

  • pageview

  • screenview

  • customMap

  • time

  • exception

  • linker

  • purchase

  • refund

  • set

  • optIn

  • optOut

component scope

export default {
  name: "MyComponent",

  methods: {
    track() {
      this.$gtag.pageview("/about");
    },
  },
};

or like this

import { pageview } from 'vue-gtag'

export default {
  name: "MyComponent",

  methods: {
    track() {
       pageview("/about");
    },
  },
};

Last updated