{"id":5260,"date":"2024-03-25T17:49:59","date_gmt":"2024-03-25T14:49:59","guid":{"rendered":"https:\/\/trackingchef.com\/?p=5260"},"modified":"2024-03-25T17:50:01","modified_gmt":"2024-03-25T14:50:01","slug":"facebook-advanced-matching-for-web","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/facebook\/facebook-advanced-matching-for-web\/","title":{"rendered":"Facebook Advanced Matching for Web"},"content":{"rendered":"\n
As discussed in a previous post about Facebook’s Event Matching<\/a>, there are various ways that the Facebook pixel (client and server side) is able to match a certain event with a user.<\/p>\n\n\n\n These methods are split into two – deterministic and probabilistic. For the deterministic methods, we need explicit identification of the user. One way that the Facebook pixel is able to achieve that is, well, by collecting user information that the user provides on the website, i.e. on forms.<\/p>\n\n\n\n Facebook offers two methods to collect this data – manual or automated.<\/p>\n\n\n\n There are multiple user parameters that can be sent to Facebook. These fields include:<\/p>\n\n\n\n As you can see, not all of these can provide accurate identification of a user. For example, a pixel sending over to Facebook user parameters of “Elad Levy from Modiin” will probably match half a dozen users or more. For optimal matching, a unique identifier such as an email or phone number is recommended.<\/p>\n\n\n\n If you have the Facebook pixel installed hardcoded on your site follow these instructions.<\/p>\n\n\n\n The basic Facebook pixel load you have should look similar to this:<\/p>\n\n\n\n (I’m intentionally ignoring the <noscript> tag and you should too)<\/p>\n\n\n\n The above script initializes the specific pixel ID on your site and then triggers a PageView event.<\/p>\n\n\n\n If the user on your site is already identified (i.e. logged in), you can update the init<\/em> function in the script in this way:<\/p>\n\n\n\n Note that email values will be hashed automatically by the pixel using SHA-256<\/p>\n<\/blockquote>\n\n\n\n Any event following this init <\/em>function will carry the user data.<\/p>\n\n\n\n If the user identification happened after the pixel has been initialized, you can trigger a second init<\/em> call and subsequent events will carry the user data parameters. <\/p>\n\n\n\n If you installed the Facebook pixel using Google Tag Manager (GTM), I hope you’ve used the great custom template created by Simo Ahava (now managed by the Facebook team). I explain why it’s better than using a Custom HTML tag in this post<\/a>. If you’re sticking to Custom HTML, just follow the instructions for the manual implementation above.<\/p>\n\n\n\n The setup is pretty straightforward in GTM. <\/p>\n\n\n\n In your Facebook Pixel tag, tick the “Enable Advanced Matching” checkbox. This will open up a new section named “Customer Information Data Parameters”.<\/p>\n\n\n\n Under the new section, you can select the available parameters (e.g. Email, First Name etc.) and match them with the relevant variable holding that data.<\/p>\n\n\n\n This too can be done on the user identification (i.e. the signup or log-in event) using a custom event.<\/p>\n\n\n\n Important note<\/strong><\/p>\nIf you’re using the GTM template, the fbq(init) method is called only once per page. This means a manual init event using a Custom HTML tag is required for sending Advanced Matching keys to events beyond the page view event.<\/cite><\/blockquote>\n\n\n\n If you don’t want (or can’t) alter your pixel implementation, you can also opt-in for Facebook to collect the data automatically from website forms. <\/p>\n\n\n\n While I usually advocate for sending data explicitly (for increased accuracy) this scraping method is usually good enough for increasing Event Match Quality with minimal effort.<\/p>\n\n\n\nUser Data Parameters<\/h2>\n\n\n\n
\n
Manually sending user data<\/h2>\n\n\n\n
Hardcoded pixel<\/h3>\n\n\n\n
<script>\n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n fbq('init', '1234567890');\n fbq('track', 'PageView');\n<\/script><\/code><\/pre>\n\n\n\n
fbq('init', '283859598862258', {\n em: 'jon@snow.com',\n fn: 'Jon', \n ln: 'snow' \n});<\/code><\/pre>\n\n\n\n
\n
Google Tag Manager<\/h3>\n\n\n\n
<\/figure>\n\n\n\n
\n
Automatically sending user data<\/h2>\n\n\n\n