purchase

Options API

export default {
  name: 'MyComponent',

  methods: {
    track () {
      this.$gtag.purchase({
        "transaction_id": "24.031608523954162",
        "affiliation": "Google online store",
        "value": 23.07
      })
    }
  }
}

Composition API

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

export default {
  name: "MyComponent",

  setup() {
    const { purchase } = useGtag() 
    const track = () => {
      purchase({
        "transaction_id": "24.031608523954162",
        "affiliation": "Google online store",
        "value": 23.07
      })
    };

    return {
      track,
    };
  },
};

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

Last updated