Skip to content

Advanced Matching

Updated: Dec 21, 2023

This document explains how to manually implement advanced matching for tracked conversion events using the Meta Pixel.

Please visit the Privacy and Data Use Guide⁠ to learn what data is sent when using the Meta Pixel.

To automatically implement advanced matching⁠ use the Events Manager⁠.

Implementation

To use advanced matching, format the visitor's data as a JSON object and include it in the pixel base code fbq('init') function call as a third parameter.

Be sure to place advanced matching parameters in the pixel base code or the values will not be treated as manual advanced matching values.

For example, if your pixel ID was 283859598862258, you could do this:

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

Note: We accept both lowercase unhashed and normalized SHA-256 hashed email addresses in your function calls

Sending More Hashed Values

You can use the <img> tag to pass your own visitor data if you format and hash your user data using a SHA-256 hashing algorithm.

The following is an example of passing hashed user email, first name, and last name:

<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr/?id=PIXEL_ID&ev=Purchase
  &ud[em]=f1904cf1a9d73a55fa5de0ac823c4403ded71afd4c3248d00bdcd0866552bb79
  &ud[fn]=4ca6f6d5a544bf57c323657ad33aae1a019c775518cf4414beedb86962aea7c1
  &ud[ln]=41f3e15ff8a4e4117da46465954304497ef29bdf35afaa9e36d527864d24c266
  &cd[value]=0.00
  &cd[currency]=USD" />

Reference

User DataParameterFormatExample
EmailemUnhashed lowercase or hashed SHA-256jsmith@example.com or 6e3913852f512d76acff15d1e402c7502a5bbe6101745a7120a2a4833ebd2350
First NamefnLowercase lettersjohn
Last NamelnLowercase letterssmith
PhonephDigits only including country code and area code16505554444
External IDexternal_idAny unique ID from the advertiser, such as loyalty membership ID, user ID, and external cookie ID.a@example.com
GendergeSingle lowercase letter, f or m, if unknown, leave blankf
BirthdatedbDigits only with birth year, month, then day19910526 for May 26, 1991.
CityctLowercase with any spaces removedmenlopark
State or ProvincestLowercase two-letter state or province codeca
Zip or Postal CodezpString94025
CountrycountryLowercase two-letter country codeus

Learn More

Unofficial mirror for reference/search purposes. All content originates from developers.facebook.com — see the source link at the top of each page. Machine-readable indexes: llms.txt · llms-full.txt · About