All Collections
Technical Knowledge base
Pixel Management
Setting up your Pixel: Advanced Matching
Setting up your Pixel: Advanced Matching

Increase the matching rate between your visitors and Facebook!

Orel Gilad avatar
Written by Orel Gilad
Updated over a week ago

The regular Facebook Pixel is relying on cookies to match the users and their conversions. But what if the cookies aren't activated on the user's side?

The Facebook Pixel's Advanced Matching feature is a way to send your visitors' data by yourself to increase the matching rate between them and the Facebook users.

Basic setup

We'll assume you have your basic Pixel implementation done, which is supposed to look like this:

<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', '283859598862258');
  fbq('track', 'PageView');
</script>
<!-- End Facebook Pixel Code -->

To use the Advanced Matching, push your visitors' data during the initialization of the pixel using a JSON object like this example:

<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', '283859598862258', {
    em: '[email protected]',
    fn: 'john',
    ln: 'smith'
  });
  fbq('track', 'PageView');
</script>
<!-- End Facebook Pixel Code -->

This data has to be in clear, as it will be hashed by Facebook when the Pixel will be loaded. Please find below the full list of data that can be sent through the Advanced Matching.

  • ct : the City in lower case, with spaces removed.

  • country : the Country, in ISO 3166-1 alpha-2 (two letters like US or FR).

  • db : the Date of Birth, following the YYYYMMDD format (e.g. 19890729).

  • em : the Email address of the visitor.

  • fn : the First Name, in lower case.

  • ge : the Gender, f or m , blank if unknown.

  • ln : the Last Name, in lower case.

  • ph : the Phone Number (only the digits with country code, area code, and number).

  • st : the State (two letters state code) in lower case.

  • zp : the five digits Zip Code.

The Image Tag specificities

The basic Facebook Pixel implementation contains another line of code which is useful for web browsers that are not enabling JavaScript:

<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=283859598862258&ev=PageView&noscript=1"/></noscript>

The Advanced Matching can be implemented here too but in that specific case, all of the data must be hashed before on your side using SHA-256 encryption.

All of the data listed before can be sent, using the ud[tag]=value parameter (where tag is the data you wanna send, and value is its hashed value)

Here is an example of a Purchase event with some Advanced Matching data implemented (and hashed):

<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"/>
Did this answer your question?