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.

Personally Identifiable Information Data Types

Data Parameter Example Format Guideline

City

ct

menlopark

City in lower case with spaces removed

Country

country

US

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

Date of Birth

db

19911226

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

Email

em

jsmith@example.com

Lower case email address of person

First Name

fn

john

Lower case first name

Gender

ge

m

Either f or m, if unknown, leave blank

Last Name

ln

smith

Lower case last name

Phone

ph

16505551212

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

State

st

ca

Two letter state code

Zip

zp

94035

Five digit zip code

When formatting your values, follow the guidelines outlined in our Business Help Center documentation.

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