Advanced Matching

This document explains how to manually implement advanced matching for tracked conversion events using the Facebook 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 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.

Reference

Customer Information Data Parameters

DataParameterFormatExample

Email

em

jsmith@example.com

First Name

fn

Lowercase letters

john

Last Name

ln

Lowercase letters

smith

Phone

ph

Digits only including country code and area code

16505554444

Gender

ge

Single lowercase letter, f or m, if unknown, leave blank

f

Birthdate

db

Digits only with birth year, month, then day

19910526 for May 26, 1991.

City

ct

Lowercase with any spaces removed

menlopark

State or Province

st

Lowercase two-letter state or province code

ca

Zip or Postal Code

zp

Digits only

94025

Country

cn

Lowercase two-letter country code

us

Demo Video

See how to implement advanced matching with the Facebook pixel