You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

meta-pixel

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meta-pixel

Wrapper for meta pixels

1.1.0
latest
Source
npm
Version published
Weekly downloads
2.4K
-43.05%
Maintainers
1
Weekly downloads
 
Created
Source

meta-pixel

npm version npm downloads License

TypeScript implementation of the facebook's pixel script. This is a client-side only library.

Usage

Manually setup pixels

import { addScriptDefault } from 'meta-pixel'

const fbq = addScriptDefault()
fbq('set', 'autoConfig', 'pixel_01', true)
fbq('init', 'pixel_01')
fbq('track', 'PageView')

Using setup & multi pixels

import { setup } from 'meta-pixel'

const { $fbq } = setup()
  .init('pixel_01')
  .init('pixel_02', false)
  .pageView()

$fbq('track', 'CompleteRegistration')

Combining both

import { addScriptDefault, setup } from 'meta-pixel'

const fbq = addScriptDefault()
setup(fbq)
  .init('pixel_01')
  .init('pixel_02')
  .pageView()

fbq('track', 'CompleteRegistration')

Manually define fbevents script

- const fbq = metapixel.addScriptDefault()
+ const fbq = metapixel.addScript(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js')

Resources

Keywords

meta

FAQs

Package last updated on 17 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts