Marketing API Version

Ad Pixel

Reading

A Facebook pixel is a small piece of JavaScript code that an advertiser places on every page of their website. This piece of code provides a set of lightweight functionalities for sending user-specific events and event-specific custom data to Facebook. Advertisers can use the Facebook pixel to capture intent information about how people are using their website. A single Facebook pixel is added to all pages of a website, and is then used to create website custom audiences

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
  • ads_management
Page management Apps
No data
Other Apps
No data
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription

id

numeric string

ID of the pixel

can_proxy

bool

can_proxy

code

string

Pixel code to be placed on the website

creation_time

datetime

Time at which the pixel was created

creator

The user who created this pixel

is_created_by_business

bool

Flag stands for if a pixel is created by busines

last_fired_time

datetime

Time at which the pixel was last fired

name

string

Name of the pixel

owner_ad_account

Ad Account that owns this pixel

owner_business

Business

ID of the business that owns this pixel or null if the pixel has not been claimed by any business yet.

Edges

EdgeDescription

assigned_users

assigned_users

audiences

The website custom audiences sourced by this pixel

da_checks

A list of results after running Dynamic Ads checks on this pixel.

shared_accounts

Ad Accounts in the same business that this pixel is shared

shared_agencies

Agencies or other businesses this pixel is shared with

stats

Stats data for this pixel

Validation Rules

ErrorDescription
275Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects.
100Invalid parameter
274The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API
273This Ads API call requires the user to be admin of the ad account

Creating

Example

You can make a POST request to adspixels edge from the following paths:
When posting to this edge, an AdsPixel will be created.

Parameters

NameDescription
name
string

Name of the pixel

Required

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Example

You can make a POST request to adspixels edge from the following paths:
When posting to this edge, an AdsPixel will be created.

Parameters

NameDescription
name
string

Name of the pixel

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Validation Rules

ErrorDescription
100Invalid parameter

Updating

Example

You can update an AdsPixel by making a POST request to /{ads_pixel_id}.

Parameters

NameDescription
name
string

Name of the pixel

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Validation Rules

ErrorDescription
100Invalid parameter

Deleting

You can't perform this operation on this endpoint.