This document explains how to manually implement advanced matching for tracked conversion events using the Facebook Pixel.
Please visit the Facebook Privacy and Data Use Guide to learn what data is sent when using Facebook pixel.
To automatically implement advanced matching use the Events Manager.
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', '{facebook-pixel-id}', { em: '{user-email}', // Values will be hashed fn: '{user-first-name}', // automatically by the pixel ln: '{user-last-name}' // using SHA-256 ... });
The following is an example of passing hashed user data:
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr/?id={pixel-id}&ev=Purchase &ud[em]={hashed-email-data} &ud[fn]={hashed-first-name} &ud[ln]={hashed-last-name} &cd[value]=0.00 &cd[currency]=USD" />
You can use the <img>
tag to pass your own visitor data however you must format and hash your user data using a SHA-256 hashing algorithm.
User Data | Parameter | Format | Example |
---|---|---|---|
|
| ||
First Name |
| Lowercase letters |
|
Last Name |
| Lowercase letters |
|
Phone |
| Digits only including country code and area code |
|
External ID |
| Any unique ID from the advertiser, such as loyalty membership ID, user ID, and external cookie ID. |
|
Gender |
| Single lowercase letter, |
|
Birthdate |
| Digits only with birth year, month, then day |
|
City |
| Lowercase with any spaces removed |
|
State or Province |
| Lowercase two-letter state or province code |
|
Zip or Postal Code |
| Digits only |
|
Country |
| Lowercase two-letter country code |
|