Advanced Matching

The Facebook pixel relies on cookies to match Facebook Users to their tracked conversions. If your website visitors have cookies disabled, you can use the pixel's advanced matching feature to include visitor data when the pixel loads. We will then use this data to attempt to match any tracked conversions to their respective Facebook Users.

To use advanced matching, format the visitor's data as a JSON object and include it in your pixel's base code fbq('init') function call as a third parameter. For example, if your pixel ID was 283859598862258, you could do this:

fbq('init', '283859598862258', {
  em: 'jsmith@example.com',  // Values will be hashed
  fn: 'john',                // automatically by the pixel
  ln: 'smith'                // using SHA-256
  ...
});

Visitor Data

You can include the following visitor data in your JSON object. We recommend that you include as much data as possible in order to increase the chance that we successfully match your tracked events to specific Facebook Users.

All values will be hashed automatically by the pixel, unless you have implemented the pixel using an <img> tag, in which case you must hash the values on your own.

Customer Information Data Parameters

Data Parameter Description

City

ct

City in lower case without spaces or punctuation: menlopark

Country

country

Two letter country code in ISO 3166-1 alpha-2: US

Date of Birth

db

Date of birth year, month, day, such as 19971226 for December 26, 1997: 19911226

Email

em

Lower case email address of person: jsmith@example.com

External ID

external_id

Any unique ID from the advertiser, such as loyalty membership IDs, user IDs, and external cookie IDs.

First Name

fn

Lower case first name: john

Gender

ge

Either f or m, if unknown, leave blank

Last Name

ln

Lower case last name: smith

Phone Number

ph

Phone number, only digits with country code, area code, and number: 16505551212

State

st

Two letter state code: ca

Zip

zp

Five digit zip code: 94035

Security

The pixel uses an HTTPS connection and a dedicated SHA-256 hashing function to hash your JSON object at the browser level before submitting it to our servers. We then use the hashed value to match tracked conversions to their respective Facebook Users. If you have implemented the pixel using an image tag, however, you must hash the JSON object on your own.

All data submitted in your JSON object will be deleted within 48 hours after the matching process ends, regardless of outcome, unless we need to retain any data for troubleshooting or product improvement.

Image Tag

If you have implemented the pixel using an <img> tag, you can still use advanced matching, but you must format and hash your visitor data using a SHA-256 hashing algorithm on your own. For example:

<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr/?id=283859598862258&ev=Purchase
  &ud[em]=fb98d44ad7501a959f3f4f4a3f004fe2d9e581ea6207e218c4b02c08a4d75adf
  &ud[fn]=77646f5a4f3166637627abe998e7a1470fe72d8b430f067dafa86263f1f23f94
  &ud[ln]=b096a1f9e07810cca55a4b0114e721dda19ff2d6a2ab028b71adc06a34d46132
  &cd[value]=0.00
  &cd[currency]=USD" /> 

Demo Video

See how to implement advanced matching with the Facebook pixel