Socket
Socket
Sign inDemoInstall

@rivercode/facebook-conversion-api

Package Overview
Dependencies
60
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @rivercode/facebook-conversion-api

Facebook Conversion API Wrapper for Node.js


Version published
Weekly downloads
97
decreased by-6.73%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Facebook Conversion API

Node.js wrapper for Facebook's Conversion API

Install

npm install @rivercode/facebook-conversion-api

Initiate Facebook Conversion API

// ES6 import or TypeScript
import FacebookConversionAPI from '@rivercode/facebook-conversion-api';
// CommonJS
const FacebookConversionAPI = require('@rivercode/facebook-conversion-api').default;

const FBConversionAPI = new FacebookConversionAPI(
  'accessToken',
  'pixelId',
  ['email1', 'email2'], // or null
  ['phone1', 'phone2'], // or null
  'clientIpAddress',
  'clientUserAgent',
  'fbp', // or null
  'fpc', // or null
  'debug', // default to false
);

Read more here on how you can get your access token and fbp/fpc identifiers.

ViewContent Event

FBConversionAPI.addProduct('productSku', quantity);
FBConversionAPI.sendEvent('ViewContent', sourceUrl, { value: 1000, currency: 'USD' }, { eventId: 'eventId' });

Add To Cart Event

FBConversionAPI.addProduct('productSku', quantity);
FBConversionAPI.sendEvent('AddToCart', sourceUrl, { value: 1000, currency: 'USD' }, { eventId: 'eventId' });

Initiate Checkout Event

FBConversionAPI.addProduct('productSku', quantity);
FBConversionAPI.sendEvent('InitiateCheckout', sourceUrl, { value: 1000, currency: 'USD' }, { eventId: 'eventId' });

Purchase Event

FBConversionAPI.addProduct('productSku', quantity);
FBConversionAPI.sendEvent('Purchase', sourceUrl, { value: 1000, currency: 'USD' }, { eventId: 'eventId' });

Keywords

FAQs

Last updated on 28 Apr 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc