set

Options API

export default {
  name: 'MyComponent',

  methods: {
    track () {
      this.$gtag.set({
        'currency': 'USD',
        'country': 'US'
      })
    }
  }
}

Composition API

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

export default {
  name: "MyComponent",

  setup() {
    const { set } = useGtag() 
    const track = () => {
      set({
        'currency': 'USD',
        'country': 'US'
      })
    };

    return {
      track,
    };
  },
};

Last updated