Table of Contents

Using a Facebook Pixel to create action-based audiences in Facebook Ads

This tutorial describes how to customize a Facebook Pixel to include the information required by the Paid Web Service, and how to convert a Facebook event into a people-based audience.

For more information about the Facebook Pixel, see Creating and installing a Facebook Pixel.

  1. Create a Facebook Pixel in Facebook Ads. To help you configure the Pixel, see Sample Javascript to send Next-Best-Actions to the advertising pixel.
    Make sure to include the following line in the <script> section of the pixel code:
    The value of the AudienceName parameter is provided by the PaidAudiencesContainer REST service. This service returns a list of all paid audiences to which an individual belongs, that is, the latest actions selected for the individual by the Next-Best-Action strategy. For more information about the PaidAudiencesContainer REST service and its parameters, see "PaidAudiencesContainer REST service" in the Pega Marketing User Guide on the Pega Marketing product page.
  2. Install the Facebook pixel on your website.
  3. To verify that the pixel is correctly configured, generate some website traffic, and then log in to Facebook Events Manager, as in the following figure:
    Sample events created with data provided by Next-Best-Action
    "Sample events created with data provided by Next-Best-Action"
    Sample events created with data provided by Next-Best-Action
    There might be a delay of several minutes before the events are created. For more information, see Navigate Events Manager for Facebook Pixel.
  4. To use the event data in your targeting, convert the events to Facebook audiences:
    1. Log in to Facebook Business Manager.
    2. Click Audiences > Create Audience > Custom Audience.
    3. In the list of sources, select Website traffic.
    4. In the Add people to your audience section, select your custom event, as in the following figure:
      Creating an audience from event data provided by Next-Best-Action
      "Creating an audience from event data provided by Next-Best-Action"
      Creating an audience from event data provided by Next-Best-Action
    5. Save the audience and use it in your Facebook campaigns.


The Facebook Pixel is now installed on your website and ready to gather information about visitor activity on your website, enriched with data about Next-Best-Actions selected for them by Pega Marketing. If you want to implement a Google Ads pixel, continue to the next section of this tutorial.

Suggest Edit

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.