Skip to main content

Meta Pixel

packages/destinations/web/meta-pixel @elbwalker/destination-web-meta-pixel

Meta Pixel allows tracking visitor activity on a website and tracking conversions that appear in the Meta Ads Manager.

Configuration

To integrate Meta Pixel with your web application using walker.js, begin by setting up the configuration. The destination can be utilized in both Node and browser environments.

const config = {
custom: {
pixelId: '1234567890',
currency: 'EUR',
pageview: true,
},
mapping: {
// e.g. order
entity: {
// e.g. complete
action: {
custom: {
id: 'data.id',
name: 'data.title',
track: 'Purchase',
value: 'data.revenue',
},
},
},
},
};

CustomConfig

PropertyTypeDescription
pixelId*stringThe ads account ID used for every conversion
currencystringDefault currency for conversions
pageviewbooleanWhether to send the PageView event

Properties with a * are required.

CustomEventConfig

For the custom event mapping (mapping.entity.action.custom):

For track, use one of the official standard event names, otherwise trackCustom will be used.

PropertyTypeDescription
content_idsstringData property key to use in content_ids, e.g., "data.product_ids".
content_namestringData property key to use as content_name, e.g., "data.product_name".
content_typestringType of content, e.g., "product".
contentsobjectContains id and quantity for content, accessible via wildcard.
trackstringStandard event to track, e.g., "Purchase".
valuestringData property key for value, e.g., "data.value".

contents is an object with the following properties:

  • id: PropertyMapping (string or object with key and optional default)
  • quantity: PropertyMapping (string or object with key and optional default)

How to use

First, define the config that you want to use for the destination:

const config = {
custom: {
pixelId: '1234567890',
},
};

Choose one of the following installation options to use the destination:

Install the destination via npm

npm i --save @elbwalker/destination-web-meta-pixel
import { elb } from '@elbwalker/walker.js';
import destinationMetaPixel from '@elbwalker/destination-web-meta-pixel';

elb('walker destination', destinationMetaPixel, config);