vue3-facebook-pixel

Tiny Facebook Pixel API wrapper for Vue 3
2,053
Install
npm install vue3-facebook-pixel
Latest Version:1.0.4
Vue:3
License:MIT
Last Updated:Jan 5, 2025
Links: GitHub  ·  npm
Maintainer: ap-arto

Vue 3 Facebook Pixel

Tiny wrapper around Facebook Pixel API for Vue 3.

Prerequisites

To use this plugin you need an installed Facebook Pixel.

Install

With NPM:

$ npm i vue3-facebook-pixel --save

Usage

Vue 3 Composition API

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>

Related Packages

vue-facebook-page

A small plugin to add a facebook page slider in your components

1,630
nuxt-meta-pixel

Nuxt best module to use Facebook's pixels in your application.

111,555 30

Version History

Version Released Vue License
1.0.4 3.x MIT
1.0.3 ~3.0 MIT
1.0.2 ~3.0 MIT
1.0.1 ~3.0 MIT
1.0.0 ^3.4.21 MIT