Tiny wrapper around Facebook Pixel API for Vue 3.
To use this plugin you need an installed Facebook Pixel.
With NPM:
$ npm i vue3-facebook-pixel --save
main.js:
import { createApp } from 'vue'
import { VueFbq } from 'vue3-facebook-pixel'
import App from './App.vue'
const app = createApp(App)
app.use(VueFbq, { pixelId: 'your-pixel-id', debug: true })
MyComponent.vue:
<script setup>
import { useFbq } from 'vue3-facebook-pixel'
const fbq = useFbq()
const trackPurchase = () => {
// events reference: https://developers.facebook.com/docs/meta-pixel/reference
fbq.event('Purchase', {
currency: 'USD',
value: '7.99'
})
}
</script>