{"id":20431,"date":"2020-01-29T17:50:14","date_gmt":"2020-01-29T17:50:14","guid":{"rendered":"https:\/\/www.arimetrics.com\/glosario-digital\/facebook-pixel"},"modified":"2024-10-06T11:17:26","modified_gmt":"2024-10-06T11:17:26","slug":"facebook-pixel","status":"publish","type":"encyclopedia","link":"https:\/\/www.arimetrics.com\/en\/digital-glossary\/facebook-pixel","title":{"rendered":"Facebook Pixel"},"content":{"rendered":"<p><img decoding=\"async\" class=\"boxpad wp-image-14291 size-full alignright\" src=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/Facebook_Pixel.jpg\" alt=\"Facebook Pixel\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/Facebook_Pixel.jpg 300w, https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/Facebook_Pixel-150x150.jpg 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><strong>Definition:<\/strong><\/p>\n<p>The <strong>Facebook Pixel<\/strong> is a javaScript code that cplaces an empty 1 x 1 pixel image and is inserted into the pages of a website to track visits and conversions coming from Facebook. When the script is loaded on the page, it sends a hit to Facebook that allows it to see what type of hit it is (page view or interaction), and allows you to generate audiences based on user profiles. The <em>Facebook Pixel<\/em> allows you to create more efficient campaigns in <a href=\"https:\/\/www.arimetrics.com\/agencia-facebook-ads\">Facebook Ads<\/a>, and allows you to create lookalike audiences and retargeting on Facebook to users who have visited the website, or have performed certain actions on it.<\/p>\n\n<h2 class=\"indexed\"><span class=\"heading_text\">Standard installation of the Facebook Pixel<\/span><\/h2>\n<p>Facebook provides all the <strong>information<\/strong> to install the pixel at the following link:<\/p>\n<p><a href=\"https:\/\/business.facebook.com\/business\/help\/952192354843755?helpref=page_content\" target=\"_blank\" rel=\"noopener\">https:\/\/business.facebook.com\/business\/help\/952192354843755?helpref=page_content<\/a><\/p>\n<p>The <strong>code base<\/strong> is obtained directly from the event manager and has the following format:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-1632 aligncenter\" src=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/facebook-pixel-instalacion.png\" alt=\"Installing Facebook Pixel\" width=\"600\" height=\"277\" srcset=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/facebook-pixel-instalacion.png 600w, https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/facebook-pixel-instalacion-300x139.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>This script can be easily installed on the website, either manually or through Google Tag Manager, and must be installed on all pages that you want to be part of the measurement.<\/p>\n<p class=\"indexed\"><strong><span class=\"heading_text\">Conversion events on Facebook<\/span><\/strong><\/p>\n<p>Once the Facebook Pixel is configured, it is possible to configure<br \/>\n<strong>conversion events<\/strong>, which can have two formats:<\/p>\n<ul>\n<li><strong>Standard conversions:<\/strong> a code is inserted or also through Google Tag Manager so that the conversion code jumps when the interaction you want to measure occurs.<\/li>\n<li><strong>Custom conversions:<\/strong>Can be configured without codes by applying URL rules.<\/li>\n<\/ul>\n<h2>Implementation of the Facebook Pixel via API<\/h2>\n<p>The implementation of the Facebook Pixel can also be done using the Facebook API, which allows sending events programmatically without the need to insert JavaScript code on each page.<br \/>\nBelow are the instructions on how to perform this implementation:<\/p>\n<h3>Initial Configuration<\/h3>\n<p>Obtain an Access Token: To use the API, an access token must be obtained from the Facebook Developer Portal.<br \/>\nThis token is required to authenticate requests to the API.<\/p>\n<h3>Send Events through the API<\/h3>\n<p>To send events to the Facebook Pixel, it is necessary to make an HTTP POST request to the Pixel events API.<\/p>\n<p>The steps are as follows <strong>API URL:<\/strong><\/p>\n<p>The URL to send events is: <a href=\"https:\/\/graph.facebook.com\/v12.0\/YOUR_PIXEL_ID\/events?access_token=YOUR_ACCESS_TOKEN\" target=\"_blank\" rel=\"noopener\">https:\/\/graph.facebook.com\/v12.0\/YOUR_PIXEL_ID\/events?access_token=YOUR_ACCESS_TOKEN<\/a><\/p>\n<p>It is important to replace YOUR_PIXEL_ID with the Pixel ID and YOUR_ACCESS_TOKEN with the access token obtained. <strong>Request Body:<\/strong> The body of the request must contain the details of the event to be sent.<\/p>\n<p>The following is an example of how the request body for a Purchase event could be structured:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">{\r\n  \"data\": [\r\n    {\r\n      \"event_name\": \"Purchase\",\r\n      \"event_time\": 1610000000,\r\n      \"user_data\": {\r\n        \"em\": [\"hashed_email@example.com\"]\r\n      },\r\n      \"custom_data\": {\r\n        \"currency\": \"USD\",\r\n        \"value\": 30.00\r\n      }\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p><strong>Make the Request:<\/strong> Tools such as Postman or programming libraries (e.g. Axios in JavaScript or Requests in Python) can be used to send the POST request. It is critical to configure the request to include the body in JSON format.<\/p>\n<p><strong>Event Verification:<\/strong> After sending the events, it is advisable to verify that they are being registered correctly.<br \/>\nThis can be done through the Facebook Event Manager, where you can view the events in real time and make sure that the information is being sent properly.<\/p>\n<p><strong>Maintenance and Updating:<\/strong> It is important to monitor event performance and make adjustments as needed.<br \/>\nIt should also be ensured that the implementation is kept up to date with any changes to the Facebook API.<\/p>\n<p>With these steps, it is possible to implement the Facebook Pixel using the API, allowing events to be sent programmatically and flexibly, without the need to insert JavaScript code directly into the website.<\/p>\n<h2 class=\"indexed\"><span class=\"heading_text\">Conversion types available on Facebook<\/span><\/h2>\n<p>The conversion types available on Facebook are as follows:<\/p>\n<ul>\n<li>Add to wishlist<\/li>\n<li>Add to cart<\/li>\n<li>Add payment information<\/li>\n<li>To find<\/li>\n<li>Find Location<\/li>\n<li>Calendar<\/li>\n<li>Lead<\/li>\n<li>Purchase<\/li>\n<li>Contact<\/li>\n<li>Content viewed<\/li>\n<li>Submit Request<\/li>\n<li>Donate<\/li>\n<li>Start payment<\/li>\n<li>Start Test<\/li>\n<li>Customize product<\/li>\n<li>Full registration<\/li>\n<li>Subscribe<\/li>\n<li>Other<\/li>\n<\/ul>\n<p>The conversion script has the following format:<\/p>\n<pre>fbq('track', 'Purchase', {currency: \"USD\", value: 30.00})<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Definition: The Facebook Pixel is a javaScript code that cplaces an empty 1 x 1 pixel image and is inserted into the pages of a website to track visits and conversions coming from Facebook. When the script is loaded on the page, it sends a hit to Facebook that allows it to see what type [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"template":"","encyclopedia-tag":[411,364],"class_list":["post-20431","encyclopedia","type-encyclopedia","status-publish","hentry","encyclopedia-tag-facebook-en","encyclopedia-tag-social-ads-en"],"_links":{"self":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia\/20431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia"}],"about":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/types\/encyclopedia"}],"author":[{"embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/users\/6"}],"wp:attachment":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/media?parent=20431"}],"wp:term":[{"taxonomy":"encyclopedia-tag","embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia-tag?post=20431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}