Create a new Pixel
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
POST https://us-central1-appgregator.cloudfunctions.net/facebook/adpixel/
Query Parameters
Name
Type
Description
name*
String
ft-4
connection_name*
String
fbads-01
adaccount_id*
String
act_1217648562383717
Headers
Name
Type
Description
x-api-key*
String
U2Fsd...
{
"id": "814765166375068"
}{
"error": {
"message": "More than one pixel exist for this account",
"type": "OAuthException",
"code": 6202,
"error_subcode": 1784012,
"is_transient": false,
"error_user_title": "Too many pixels in ad account",
"error_user_msg": "We found more than 1 ads pixels in ad account 23850279712480684, and cannot decide which one to use.Please specify the ads pixel ID that you would like to use.",
"fbtrace_id": "AEfFiSfcyPEbpoAz_KML7fK"
}
}curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/facebook/adpixel?name=ft-4&connection_name=fbads-01&adaccount_id=act_1217648562383717' \
--header 'x-api-key: U2Fsd...' \
--header 'Content-Type: application/json' \
--data-raw '{
"name" : "WCA Pixel-1",
"app_id" : "600957674560496",
"app_secret" : "7459f5c27e9a0482cf62879ba5723fbd"
}'var axios = require('axios');
var data = JSON.stringify({
"name": "WCA Pixel-1",
"app_id": "600957674560496",
"app_secret": "7459f5c27e9a0482cf62879ba5723fbd"
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/facebook/adpixel?name=ft-4&connection_name=fbads-01&adaccount_id=act_1217648562383717',
headers: {
'x-api-key': 'U2Fsd...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/facebook/adpixel?name=ft-4&connection_name=fbads-01&adaccount_id=act_1217648562383717',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name" : "WCA Pixel-1",
"app_id" : "600957674560496",
"app_secret" : "7459f5c27e9a0482cf62879ba5723fbd"
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: U2Fsd...',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last updated