customMap

Options API

export default {
  name: 'MyComponent',

  methods: {
    track () {
      this.$gtag.customMap({ 'dimension2': 'age' })
      this.$gtag.event('age_dimension', { age: 35 })
    }
  }
}

Composition API

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

export default {
  name: "MyComponent",

  setup() {
    const { customMap, event } = useGtag() 
    const track = () => {
      customMap({ 'dimension2': 'age' })
      event('age_dimension', { age: 35 })
    };

    return {
      track,
    };
  },
};

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

Last updated