vue3-facebook-pixel
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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>

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i vue3-facebook-pixel

    Weekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    5.52 kB

    Total Files

    5

    Last publish

    Collaborators

    • ap-arto