3 4 5 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

What is Facebook Pixel

Facebook Pixel

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 of hit it is (page view or interaction), and allows you to generate audiences based on user profiles. The Facebook Pixel allows you to create more efficient campaigns in Facebook Ads, 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.

Standard installation of the Facebook Pixel

Facebook provides all the information to install the pixel at the following link:

https://business.facebook.com/business/help/952192354843755?helpref=page_content

The code base is obtained directly from the event manager and has the following format:

Installing Facebook Pixel

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.

Conversion events on Facebook

Once the Facebook Pixel is configured, it is possible to configure
conversion events, which can have two formats:

  • Standard conversions: a code is inserted or also through Google Tag Manager so that the conversion code jumps when the interaction you want to measure occurs.
  • Custom conversions:Can be configured without codes by applying URL rules.

Implementation of the Facebook Pixel via API

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.
Below are the instructions on how to perform this implementation:

Initial Configuration

Obtain an Access Token: To use the API, an access token must be obtained from the Facebook Developer Portal.
This token is required to authenticate requests to the API.

Send Events through the API

To send events to the Facebook Pixel, it is necessary to make an HTTP POST request to the Pixel events API.

The steps are as follows API URL:

The URL to send events is: https://graph.facebook.com/v12.0/YOUR_PIXEL_ID/events?access_token=YOUR_ACCESS_TOKEN

It is important to replace YOUR_PIXEL_ID with the Pixel ID and YOUR_ACCESS_TOKEN with the access token obtained. Request Body: The body of the request must contain the details of the event to be sent.

The following is an example of how the request body for a Purchase event could be structured:

{
  "data": [
    {
      "event_name": "Purchase",
      "event_time": 1610000000,
      "user_data": {
        "em": ["hashed_email@example.com"]
      },
      "custom_data": {
        "currency": "USD",
        "value": 30.00
      }
    }
  ]
}

Make the Request: 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.

Event Verification: After sending the events, it is advisable to verify that they are being registered correctly.
This 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.

Maintenance and Updating: It is important to monitor event performance and make adjustments as needed.
It should also be ensured that the implementation is kept up to date with any changes to the Facebook API.

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.

Conversion types available on Facebook

The conversion types available on Facebook are as follows:

  • Add to wishlist
  • Add to cart
  • Add payment information
  • To find
  • Find Location
  • Calendar
  • Lead
  • Purchase
  • Contact
  • Content viewed
  • Submit Request
  • Donate
  • Start payment
  • Start Test
  • Customize product
  • Full registration
  • Subscribe
  • Other

The conversion script has the following format:

fbq('track', 'Purchase', {currency: "USD", value: 30.00})