Facebook Pixel Destination Config Reference Beta
- free
- growth
- enterprise
8 minute read
Facebook Pixel is an advertising destination. RudderStack loads the Meta Pixel in the browser for web sources in device mode, and sends events to Meta’s Conversions API from its servers in cloud mode.
In a Facebook Pixel destination spec:
type: facebook_pixeldefinition_version: 1
Sample configuration
version: rudder/v1
kind: destination
metadata:
name: fb-pixel-prod
spec:
id: fb-pixel-prod
display_name: Facebook Pixel Production
type: facebook_pixel
definition_version: 1
enabled: true
config:
pixel_id: "{{ .FB_PIXEL_ID }}"
access_token: "{{ .FB_ACCESS_TOKEN }}"
standard_page_call: false
value_field_identifier: properties.price
advanced_mapping: true
use_updated_mapping: true
events_to_events:
- from: Order Completed
to: Purchase
limited_data_usage: false
test_destination: false
remove_external_id: false
blacklist_pii_properties:
- property: email
hash: true
auto_config:
web: true
legacy_conversion_pixel_id:
- from: Signed Up
to: "{{ .FB_LEGACY_PIXEL_ID }}"
connection_mode:
web: device
cloud: cloud
consent_management:
web:
- provider: oneTrust
consents:
- marketingThe above example loads the Pixel on web sources in device mode and sends server-side events in cloud mode. Because a source connects in cloud mode, it needs access_token — see Access token requirements.
Config keys
config accepts only the keys listed below. The shared config key rules cover unknown keys, defaults, and immutability.
Incloudmode Facebook Pixel acceptsidentify,page,screen, andtrackevents. Indevicemode, web sources sendpageandtrack.
Access token requirements
The Conversions API needs access_token; the Pixel in the browser doesn’t. Rudder CLI checks for it twice:
- On the destination.
access_tokenis required unlessconnection_modeis set and either mapswebtodeviceor leaveswebout. A spec with noconnection_modeat all, or withweb: cloud, must carry it. - On each connection. Connecting any source in
cloudmode requiresaccess_token— onlywebindevicemode is exempt. See Connect a source.
In practice: if anything connects in cloud mode, set access_token.
Connection
pixel_id
RequiredSecretType:
string
Description: ID of your Facebook Pixel, from the snippet on Facebook’s Pixel creation page.
Notes:
- At most 100 characters, and must not contain line breaks.
- A
{{ path || fallback }}template is accepted in place of a literal.
access_token
RequiredSecretType:
string
Description: Business access token from your Facebook Business account, used by the Conversions API in cloud mode.
Notes:
- Required when a source connects in
cloudmode, or whenconnection_modeis absent or mapswebtocloud. See Access token requirements. - At most 300 characters, and must not contain line breaks.
- A
{{ path || fallback }}template is accepted in place of a literal.
Event settings
standard_page_call
Type:
boolean
Default value:
false
Description:
Send a standard PageView event for every page and screen call.
value_field_identifier
Type:
string
Default value:
properties.price
Description:
Event property RudderStack maps to Facebook’s value field — used for events such as Product Viewed and Product Added.
Notes:
properties.priceorproperties.value.
advanced_mapping
Type:
boolean
Default value:
false
Description: Turn on Facebook’s advanced matching, sending user information with Pixel events. This is what the dashboard calls Enable Advanced Matching.
events_to_events
Type:
array of objects
Description: Maps RudderStack event names to Facebook standard events.
Notes:
from— RudderStack event name. At most 100 characters, and must not contain line breaks.to— one ofViewContent,Search,AddToCart,AddToWishlist,InitiateCheckout,AddPaymentInfo,Purchase,PageView,Lead,CompleteRegistration,Contact,CustomizeProduct,Donate,FindLocation,Schedule,StartTrial,SubmitApplication, orSubscribe.- The dashboard’s dropdown offers only the first 13 of those. Rudder CLI accepts all 18, matching what the API accepts.
- Both fields accept a
{{ path || fallback }}template in place of a literal.
Testing and privacy
The dashboard asks fortest_event_codewhentest_destinationis on. Rudder CLI doesn’t enforce that pairing.
test_destination
Type:
boolean
Default value:
false
Description: Use this destination for testing, so events appear in real time under Test Events in your Facebook dashboard.
test_event_code
Type:
string
Description: Test event code from your Facebook dataset’s Test Events tab.
Notes:
- Applies when
test_destinationistrue. Leave it unset otherwise. - At most 100 characters, and must not contain line breaks.
- A
{{ path || fallback }}template is accepted in place of a literal.
limited_data_usage
Type:
boolean
Default value:
false
Description:
Forward the event’s context.dataProcessingOptions to Facebook — Meta’s Limited Data Use flags.
remove_external_id
Type:
boolean
Default value:
false
Description:
Stop sending userId or anonymousId as external_id. When true, neither is sent.
blacklist_pii_properties
Type:
array of objects
Description:
Standard PII fields to drop — or, with hash: true, to SHA-256 hash and send. Standard PII fields are denylisted by default, so an entry here matters mainly to turn on hashing.
Notes:
property— the PII field name. At most 100 characters, and must not contain line breaks. A template is accepted.hash— boolean.truehashes the field and sends it;falseor unset drops it.
whitelist_pii_properties
Type:
array of objects
Description: Standard PII fields to send as they are, when present in the event’s properties.
Notes:
property— the PII field name. At most 100 characters, and must not contain line breaks. A template is accepted.
Web device mode
These keys configure the Pixel in the browser, so they apply only when connection_mode.web is device.
use_updated_mapping
Type:
boolean
Default value:
false
Description: Map user traits to Facebook’s fields instead of sending them unmodified. Turn this on; the old mapping is being deprecated.
auto_config
Type:
object
Description: Let the Pixel send button clicks and page metadata to improve ad delivery — Meta’s automatic configuration.
Notes:
web— boolean. The dashboard defaults it totrue; Rudder CLI doesn’t fill it in.
legacy_conversion_pixel_id
Type:
array of objects
Description:
Sends specific events to a legacy conversion Pixel instead of pixel_id.
Notes:
from— RudderStack event name. At most 100 characters, or a template.to— ID of the legacy conversion Pixel. At most 100 characters, or a template. Secret — see Secrets.- A plain list, not keyed by
web, though it applies only to web.
legacy_conversion_pixel_id:
- from: Signed Up
to: "{{ .FB_LEGACY_PIXEL_ID }}"See Legacy events.
Event filtering
Client-side event filtering is applied by the RudderStack SDK, so it affects only web sources connected indevicemode. Events sent incloudmode aren’t filtered by it.
event_filtering
Type:
object
Description:
Restricts which track events the SDK passes to the Pixel, by event name.
Notes:
whitelist— array of event names to allow; every othertrackevent is dropped.blacklist— array of event names to drop; every othertrackevent is allowed.- The two are mutually exclusive, and Rudder CLI enforces it — setting both fails validation.
- Each name is at most 100 characters, or a
{{ path || fallback }}template.
Per-source keys
Both keys are objects keyed by the local source type — the tokens listed under Source types. A key naming a source type this destination doesn’t support fails validation.
connection_mode
Type:
object
Description:
Maps each source type you connect to the mode its events reach Facebook in, using the modes in Source types. It also decides whether access_token is required.
Notes:
- An entry is required for each source type you connect — see Connect a source.
- A mode the source type doesn’t support on this destination fails validation — for example
deviceforandroid.
connection_mode:
web: device
cloud: cloudconsent_management
Type:
object
Description:
Consent provider configuration per source type. The entry shape, accepted providers, and the rules on resolution_strategy and consents are shared across all destination types — see Consent management.
Source types
Facebook Pixel accepts events from these source types in the mentioned connection modes:
| Source type | Connection mode |
|---|---|
android | cloud |
android_kotlin | cloud |
ios | cloud |
ios_swift | cloud |
web | cloud, device |
unity | cloud |
cloud | cloud |
react_native | cloud |
flutter | cloud |
cordova | cloud |
Only web offers device mode, which loads the Meta Pixel in the browser. See Facebook Pixel device mode.
The dashboard additionally offers Facebook Pixel to AMP, Shopify, and Reverse ETL sources. Rudder CLI doesn’t manage those connections, soamp,shopify, andwarehouseare invalid here.
Connect a source
An event stream connection to this destination is checked against three rules at validate time.
The source’s type must be supported. A source’s type resolves to one of the tokens above before the check — a JavaScript source resolves to web, and webhook and server-side SDK sources resolve to cloud. An unsupported type reports:
destination 'fb-pixel-prod' (type 'facebook_pixel') does not support source 'my-source':
source type 'amp' is not among supported source types: android, android_kotlin, ...The destination config must carry a connection_mode entry for that source type. This lives on the destination spec, not on the connection spec. Without it:
destination 'fb-pixel-prod' config has no 'connection_mode' entry for source type 'web'A source connecting in cloud mode needs access_token. Every source type requires it in cloud mode; only web in device mode doesn’t. Without it:
destination 'fb-pixel-prod' config is missing fields required to connect a 'cloud' source: access_tokenSecrets
Rudder CLI treats three keys as secrets: pixel_id, access_token, and every legacy_conversion_pixel_id entry’s to value. Write each one you use as a {{ .VAR }} reference and supply the value at apply time:
config:
pixel_id: "{{ .FB_PIXEL_ID }}"
access_token: "{{ .FB_ACCESS_TOKEN }}"export RUDDER_FB_PIXEL_ID="..."
export RUDDER_FB_ACCESS_TOKEN="..."
rudder-cli apply
# or
rudder-cli apply --var-file secrets.vars.yamlNote that:
- The YAML that
rudder-cli importwrites may or may not include secret keys. Before you apply, make sure every secret key your configuration needs is present and populated through variable substitution. - In device mode the Pixel IDs are embedded in the page’s JavaScript, so masking them protects your YAML, not the values themselves.
See How to Use Variable Substitution in Rudder CLI.
See more
- Facebook Pixel Destination for the Pixel ID, access token, updated mappings, and
fbcandfbpparameters - Facebook Conversions Destination Config Reference for the server-side-only destination
- Destination Type Reference for Rudder CLI for the rules shared across destination types