Marketing API Version

Conversion Pixels

Related Topics

These signal events that occur when users was browse your website such as viewing a product, registering or adding a product to a cart. This pixel is best used with oCPM to drive a particular event.

The Conversion Tracking pixel will be deprecated in the second half of 2016.

We are to deprecating the Conversion Tracking Pixel to help ensure advertisers are using the best solutions to drive their business. In August 2016, we will discontinue the ability to create new conversion tracking pixels (CTPs) and in February 2017 we will completely disable the conversion tracking pixel.

To assist advertisers in migrating their websites to use the new Facebook Pixel, we're also announcing refreshed help guides in Help Center and the Pixel Migration Tool. See Advertiser Help Center, Facebook Pixel

1. Create a pixel

2. Retrieve the pixel code and install on your website

3. Create a campaign with objective WEBSITE_CONVERSIONS

4. Create an ad set with promoted_object set to the pixel you've created

5. Create your ad, optionally track additional pixels

1. Create a Pixel

The first step is to create the pixel for the event that you want to track by making an HTTP POST call to<API_VERSION>/act_<AD_ACCOUNT_ID>/offsitepixels

The API will return the id of the pixel.

Offsite pixel reference

2. Install Pixel on Your Website

After you setup a pixel you should get the code that you're going to use in your website by making an HTTP GET call to<API_VERSION>/<PIXEL_ID>

You can also get the pixel code with an HTTP GET call to<API_VERSION>/<PIXEL_ID>/snippets
Offsite pixel reference

3. Create a Campaign

Set the objective to WEBSITE_CONVERSIONS so your campaign is optimized for the pixel.

curl \ 
-F 'name=My First Campaign' \  
-F 'status=PAUSED' \  
-F 'access_token=<ACCESS_TOKEN>' \<AD_ACCOUNT_ID>/adcampaigns

Verify Campaign

Verify that your campaign was created in Manage Ads , ads manager.

Manage Ads: My Campaigns

Reference: CampaignAdObjectives in PHPAdObjectives in Python

4. Create Ad Set

Now that you have a conversion pixel 12345, set it as the promoted_object of the ad set. A promoted object automatically sets the optimization goal for the ad set.

curl \
-F "name=My Pixel Ad Set" \
-F "status=PAUSED" \
-F "promoted_object={\"pixel_id\": 12345}" \
-F "lifetime_budget=20000" \
-F "start_time=<START_TIME>" \
-F "end_time=<END_TIME>" \  
-F "campaign_id=<CAMPAIGN_ID>" \  
-F "optimization_goal=OFFSITE_CONVERSIONS" \
-F "billing_event=IMPRESSIONS" \
-F "bid_amount=500" \  
-F "targeting={ \
  'geo_locations': { \
    'countries': ['US'], \
  }, \
 }" \
-F '"access_token=<ACCESS_TOKEN>" \<API_VERSION>/act_<AD_ACCOUNT_ID>/adsets
Reference: Ad SetReference: Promoted Object

5. Create your ad; Track additional pixels

To create an ad that tracks another conversion pixel with ID 67890, set the tracking_spec of the ad:

curl \
-F "ad_set_id=<AD_SET_ID>" \
-F "creative={creative_id:<CREATIVE_ID>}" \
-F "name=My Ad" \
-F "tracking_specs=[{'action.type':'offsite_conversion','offsite_pixel':67890}]" \
-F "access_token=___" \

Verify Ad

Verify that your ad was created under Manage Ads in ads manager:

  1. Click on the campaign you created.
  2. Click on the ad set you created.
  3. Click on the ad you created.

Manage Ads: My CampaignsReference: AdReference: Tracking Spec