🇺🇦 We're working: Mon-Fri: 09:00-18:00 (Kyiv) Telegram Viber whatsapp
Kiev / Odessa (Ukraine):+38-098-887-05-49

The Facebook pixel is a JavaScript code embedded in your website that is part of the Facebook statistics system and allows you to track the behavior of the users you direct to your website through Facebook ads. You can track macro conversions, micro conversions, view a specific page or complete an event you set, and collect audience lists for advertising campaigns.


The main functions of this tool include:

  • Conversion tracking and optimization
  • Retargeting and Lookalike Audiences
  • Dynamic Product Ads

 

You can create your own Facebook Pixel by going to link in Ad Manager. Click Create Pixel and then Install Pixel Now. You will be provided with a basic code that collects pageview data and looks like this:

.
!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', 'XXXXXXXXXX');
fbq('track', "PageView");
</script>
<img height="1" width="1" style="display:none"

src="https://www.facebook.com/tr?id='XXXXXXXXXX'&ev=PageView&noscript=1"

/>

Where 'XXXXXXXXXX' is a unique pixel ID for each account.

 It is important to remember that one pixel code is available per account. It is recommended to install it on every page of the site.

If GTM is installed on the site, then for convenience, you can add the code through it. You must select All Pages as the execution trigger for the tag. It will look like this:

image02

 

The following standard events are available for tracking with Facebook Pixel:

  1. View content

Key page view event (e.g. product page)

fbq('track', 'ViewContent', {
 content_name: 'Nick's Table', //Content name
 content_ids: ['121111'],   //Unique identificator
 content_type: 'product',   //Content type (for example, product page)
 value: 1.25               //Conversion cost
 currency: 'UAH'            //Currency
});


Parameters are optional for this event type. But, if you want to set up dynamic product advertising, you need to fill out content_ids And content_type.

  1.  Search

Used to track searches on the site and optimize the audience for these indicators. The above attributes are also optional.

fbq('track', 'Search', {
 search_string: 'interior doors',       //Search query
 content_category: 'Promotion Doors',       //Category
 content_ids: ['111', '222', '333', '444'], //Search result identifiers (maybe the first few)
 value: 1.00                               //Price
 currency: 'USD',                           //Currency
});

  1. Add to cart

    The event is sent after adding an item to the cart or when a button is clicked.

fbq('track', 'AddToCart', {
 content_name: 'Nick's Table',    //Name
 content_ids: ['111'],      //IDs of added products
 content_type: 'product',
 value: 3.50                                //Price
 currency: 'USD'                             //Currency
});

As with viewing materials, the parameters are optional. It is enough to send only the name of the event. But if you want to set up dynamic product ads, you need to fill out content_ids And content_type.

  1. Add to Wishlist

    fbq('track', 'AddToWishList', {
     content_name: 'Nick's Table',                  //Name
     content_ids: ['111'],      //IDs of added products
     content_type: 'product',
     value: 3.50                                //Price
     currency: 'USD'                             //Currency
    });

  2. Start of ordering

The event is dispatched when a user on your site enters the checkout funnel. For example, it can be a click on the Checkout button.

fbq('track', 'InitiateCheckout', {
 content_name: 'Nick's Table',                  //Name
 content_ids: ['111'],      //IDs of added products
 num_items: 1                               //Number of goods
 content_type: 'product',
 value: 3.50                                //Price
 currency: 'USD'                             //Currency
});

  1. Adding payment information

The event is dispatched when payment information is added in the checkout funnel.


fbq('track', 'AddPaymentInfo', {
 content_category: 'Nick's Table',    //Category
 content_ids: ['111'],   //Product IDs
 value: 3.50                      //Price
 currency: 'USD'                   //Currency
});

  1. Purchase

fbq('track', 'Purchase', {
 content_ids: ['111', '222', '333'], //Product IDs
 content_type: 'product',            //Content type
 value: 1232.23                     //Price
 currency: 'UAH'                     //Currency
});


Parameters are required for this type of events. value and currency. If you are setting up dynamic advertising for products, then you must specify content_ids and content_type.

  1.  Lead

The event is dispatched when the target action is completed. For example, submitting a form, signing up for a trial subscription, going to a pricing page, etc.

fbq('track', 'Lead', {
 content_name: 'Contextual Advertising',       //Content name
 content_category: 'Promotion Services', //Content category
 value: 1.00                                  //Price
 currency: 'UAH'                            //Currency
});

  1. Completion of registration

The trigger for sending an event is a successful subscription, registration for a service, etc.

fbq('track', 'CompleteRegistration', {
 content_name: 'Contextual Advertising',       //Content name
 status: 'Registration successful',   //Registration status
 value: 1.00                                  //Price
 currency: 'UAH'                            //Currency
});


Parameter content_type  can take the values product or product_group. It depends on what you add to the parameter content_ids identifiers of goods or groups of goods.

In addition to the standard 9 Facebook Pixel events, you can also send custom events. It will look like this:

fbq('trackCustom', ' ', {
   cp1: 'Some value',
   cp2: 1234567,
   value: 25.00
   currency: 'UAH'
});

Where custom event name
     cp1- first user parameter
  cp2- second user parameter

Custom events are used to create custom audiences or custom conversions.

You can check if the pixel is set correctly using Facebook Pixel Helper. The extension will show the validity of the code and the errors that will occur during the implementation phase.

image01

If you have a custom audience pixel installed on your site, you don't have to change anything. It can also be used in conjunction with events, but there is a slight syntax change to note. For example, instead of fbq('track', 'Search'); will need to use window._fbq.push(['track', 'AddToCart']);

After completing all the settings, the result can be seen by link. In the advertising account, the following report will be available with the traffic that the pixel has registered. When the events are configured, below you can see the statistics for each of them.

image00

If you have previously installed a conversion pixel, then you need to create a Facebook Pixel and place its base code on the site. On those pages where the conversion pixel was installed, you need to add an event to the created Facebook Pixel. The old conversion pixel will no longer be supported soon. In order not to lose statistics, it is better to update it.

Facebook Pixel is an updated tool that allows you to more effectively segment the audience, and therefore more accurately set up advertising campaigns on the social network. Working with it, you can track many user actions and, accordingly, make advertising more personalized.

If you have any difficulties or questions about the operation or installation of the pixel, ask them in the comments and we will be happy to answer them.

 

Author: web-programmer of the agency of strategic Internet marketing Star Marketing Ekaterina Demyanchuk.

 

 


About the author - Vadim Steblinsky

English