config

Options API

export default {
  name: 'MyComponent',

  methods: {
    track () {
      this.$gtag.config({
        'cookie_prefix': 'MyCookie',
        'cookie_domain': 'blog.example.com',
        'cookie_expires': 28 * 24 * 60 * 60
      })
    }
  }
}

Composition API

import { useGtag } from "vue-gtag-next";

export default {
  name: "MyComponent",

  setup() {
    const { config } = useGtag() 
    const track = () => {
      config({
        'cookie_prefix': 'MyCookie',
        'cookie_domain': 'blog.example.com',
        'cookie_expires': 28 * 24 * 60 * 60
      })
    };

    return {
      track,
    };
  },
};

Remember, this is just an example. check the all API parameters in the official gtag documentation here

Last updated