Socket
Socket
Sign inDemoInstall

@rivercode/facebook-conversion-api-nextjs

Package Overview
Dependencies
61
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @rivercode/facebook-conversion-api-nextjs

Facebook Conversion API for Next.js


Version published
Weekly downloads
454
decreased by-6.58%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Facebook Conversion API for Next.js

Next.js wrapper for Facebook's Conversion API

Install

npm install @rivercode/facebook-conversion-api-nextjs

1. Create Next.js API Route

pages/api/fb-events.js

import { FBEventsHandler } from '@rivercode/facebook-conversion-api-nextjs/handlers';

export default FBEventsHandler;

Add Facebook Access Token and Pixel ID

.env

FB_ACCESS_TOKEN=accessToken
FB_PIXEL_ID=pixelID

Read more here on how you can get your access token and pixel id.

2. Start Sending Events

import { FBEvent } from '@rivercode/facebook-conversion-api-nextjs';

FBEvent({
  eventName: 'ViewContent', // ViewContent, AddToCart, InitiateCheckout or Purchase
  emails: ['email1', 'email2'], // optional
  phones: ['phone1', 'phone2'], // optional
  products: [{
    sku: 'product123',
    quantity: 1,
  }],
  value: 1000,
  currency: 'USD',
  debug: true // default false
});

Keywords

FAQs

Last updated on 01 Sep 2021

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