Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
Copyright (c) Meta Platforms, Inc. and affiliates.
All rights reserved.
You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
copy, modify, and distribute this software in source code or binary form for use
in connection with the web services and APIs provided by Facebook.
As with any software that integrates with the Facebook platform, your use of
this software is subject to the Facebook Platform Policy
[http://developers.facebook.com/policy/]. This copyright notice shall be
included in all copies or substantial portions of the software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,111 @@
#!/usr/bin/env php
<?php
/*
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
use FacebookAds\Api;
use FacebookAds\Cursor;
use FacebookAds\Object\AbstractCrudObject;
use FacebookAds\Object\AdAccount;
use FacebookAds\Logger\CurlLogger;
use FacebookAdsTest\Bootstrap\IntegrationBootstrap;
chdir(__DIR__);
/** @var IntegrationBootstrap $bootstrap */
if (in_array('--docsmith-bootstrap', $_SERVER['argv'])) {
$bootstrap = require_once __DIR__.'/../docsmith/init_integration.php';
} else {
$bootstrap = require_once __DIR__.'/../test/init_integration.php';
}
$config = $bootstrap->getConfig();
Api::init($config->appId, $config->appSecret, $config->accessToken);
if (in_array('--dump', $_SERVER['argv'])) {
Api::instance()->setLogger(new CurlLogger(STDERR));
}
$get_class_name = function($object) {
return (new ReflectionClass($object))->getShortName();
};
$delete_object = function(AbstractCrudObject $object) use ($get_class_name) {
echo sprintf(
' > Deleting %s %d',
$get_class_name($object),
$object->{AbstractCrudObject::FIELD_ID}).PHP_EOL;
try {
$object->deleteSelf();
} catch (Exception $e) {
echo sprintf(" > Deletion failed with %s: %s",
$get_class_name($e),
$e->getMessage()).PHP_EOL;
}
};
$clean_edge = function($cursor_provider) use ($get_class_name, $delete_object) {
try {
$cursor = call_user_func($cursor_provider);
if (!$cursor instanceof Cursor) {
throw new ErrorException(sprintf(
"Provider returned instance of %s",
$get_class_name($cursor)));
}
$cursor->setUseImplicitFetch(true);
foreach ($cursor as $object) {
if (!$object instanceof AbstractCrudObject) {
throw new ErrorException(sprintf(
"Provider returned instance of %s, not a CRUD object",
$get_class_name($object)));
}
$trait = 'FacebookAds\Object\Traits\CannotDelete';
if (in_array($trait, (new ReflectionClass($object))->getTraitNames())) {
break;
}
$delete_object($object);
}
} catch (Exception $e) {
echo sprintf(" > Edge iteration failed with %s: %s",
$get_class_name($e),
$e->getMessage()).PHP_EOL;
}
};
$account = new AdAccount($config->accountId);
$reflection = new ReflectionClass($account);
foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if (
strncasecmp($method->getName(), 'get', 3) !== 0
|| preg_match('/@return\s+Cursor/', $method->getDocComment()) !== 1
) {
continue;
}
echo sprintf(' > Fetching AdAccount::%s', $method->getName()).PHP_EOL;
$clean_edge($method->getClosure($account));
}

View File

@@ -0,0 +1,112 @@
<?php
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace FacebookAdsBin;
use Symfony\Component\Finder\Finder;
chdir(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR);
require_once 'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
// Options
$include_autoloader = !in_array('--no-autoloader', $_SERVER['argv']);
$compress_gzip = !in_array('--no-gzip', $_SERVER['argv']);
$alias = 'facebook-php-ads-sdk.phar';
$build_dir = '.'.DIRECTORY_SEPARATOR.'builds'.DIRECTORY_SEPARATOR;
$out = $build_dir.$alias;
if (!is_dir($build_dir)) {
mkdir($build_dir);
} else if (file_exists($out)) {
unlink($out);
}
$phar = new \Phar($out, 0, $alias);
$phar->setSignatureAlgorithm(\Phar::SHA1);
if ($compress_gzip) {
$phar->compressFiles(\Phar::GZ);
}
$phar->startBuffering();
$phar->addFile('LICENSE');
$finder = (new Finder())->files()
->ignoreVCS(true)
->name('*.php')
->in('src');
foreach ($finder->getIterator() as $file) {
$phar->addFile($file);
}
$stub = <<<'EOF'
<?php
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
Phar::mapPhar('%s');
if (%d) {
spl_autoload_register(function($class) {
$prefix = 'FacebookAds\\';
$base_dir = 'phar://%s/src/FacebookAds/';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
$relative_class = substr($class, $len);
$file = $base_dir.str_replace(
'\\', DIRECTORY_SEPARATOR, $relative_class).'.php';
if (file_exists($file)) {
require $file;
}
});
}
__HALT_COMPILER();
EOF;
$phar->setStub(sprintf($stub, $alias, $include_autoloader ? 1 : 0, $alias));
$phar->stopBuffering();

View File

@@ -0,0 +1,68 @@
#!/usr/bin/env php
<?php
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
use FacebookAdsTest\Bootstrap;
use FacebookAdsDocsmith\Runner;
use FacebookAdsDocsmith\Runner\ActionsEnum;
use FacebookAdsDocsmith\Runner\OptionsEnum;
use FacebookAdsTest\Bootstrap\IntegrationBootstrap;
$relative_path = getcwd();
chdir(__DIR__);
/** @var IntegrationBootstrap $bootstrap */
$bootstrap = require_once __DIR__.'/../docsmith/init_auto.php';
if ($argc < 3) {
Runner::throwInvalidUsage("Insufficient number of arguments");
}
$action = $argv[1];
if (!ActionsEnum::getInstance()->isValidValue($action)) {
Runner::throwInvalidUsage("Unknown action {$action}");
}
$doc_path = $argv[2][0] == '/'
? $argv[2]
: realpath($relative_path.'/'.$argv[2]);
if (!file_exists($doc_path)) {
Runner::throwInvalidUsage("Can't open {$doc_path} for reading");
}
$opts = array_splice($argv, 3);
$options = new ArrayObject(
array_fill_keys(OptionsEnum::getInstance()->getValues(), false));
foreach ($opts as $opt) {
$opt = substr($opt, 1);
if (OptionsEnum::getInstance()->isValidValue($opt)) {
$options->offsetSet($opt, true);
}
}
$runner = new Runner($doc_path, $action, $options);
exit($runner->run());

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env php
<?php
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
use \FacebookAdsDocsmith\Bootstrap\IntegrationBootstrap;
use FacebookAds\Api;
chdir(__DIR__);
/** @var IntegrationBootstrap $bootstrap */
$bootstrap = require_once __DIR__.'/../docsmith/init_stub.php';
echo sprintf('v%s', Api::init('', '', '')->getDefaultGraphVersion()).PHP_EOL;

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getAdCreatives(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Sample Promoted Post',
'object_story_id' => '<pageID>_<postID>',
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'object_story_id' => '<pageID>_<postID>',
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'image_hash' => '<imageHash>',
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('image_hash' => '<imageHash>','link' => '<canvasURI>','name' => 'Creative message','call_to_action' => array('type' => 'LEARN_MORE'))),
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'object_story_spec' => array('page_id' => '<pageID>','template_data' => array('format_option' => 'collection_video','link' => '<canvasURI>','name' => 'English Creative title','message' => 'English Creative message','call_to_action' => array('type' => 'LEARN_MORE'),'retailer_item_ids' => array(0,0,0,0),'customization_rules_spec' => array(array('customization_spec' => array('language' => 'en_XX')),array('customization_spec' => array('language' => 'fr_XX'),'link' => '<canvasURIFR>','name' => 'French Creative title','message' => 'French Creative message')))),
'product_set_id' => '<productSetID>',
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('picture' => '<imageURL>','link' => '<canvasURI>','name' => 'English Creative title','message' => 'English Creative message','call_to_action' => array('type' => 'LEARN_MORE'),'retailer_item_ids' => array(0,0,0,0),'customization_rules_spec' => array(array('customization_spec' => array('language' => 'en_XX')),array('customization_spec' => array('language' => 'fr_XX'),'picture' => '<imageURLFR>','link' => '<canvasURIFR>','name' => 'French Creative title','message' => 'French Creative message')))),
'product_set_id' => '<productSetID>',
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'object_story_spec' => array('page_id' => '<pageID>','video_data' => array('video_id' => '<videoID>','image_url' => '<imageURL>','title' => 'English Creative title','message' => 'English Creative message','call_to_action' => array('type' => 'LEARN_MORE','value' => array('link' => '<canvasURI>')),'retailer_item_ids' => array(0,0,0,0),'customization_rules_spec' => array(array('customization_spec' => array('language' => 'en_XX')),array('customization_spec' => array('language' => 'fr_XX'),'video_id' => '<videoIDFR>','picture' => '<imageURLFR>','link' => '<canvasURIFR>','name' => 'French Creative title','message' => 'French Creative message')))),
'product_set_id' => '<productSetID>',
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Sample Promoted',
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('image_hash' => '<imageHash>','link' => '<imageURL>','message' => 'try it out')),
'degrees_of_freedom_spec' => array('creative_features_spec' => 'array(\'standard_enhancements\' => \'array(\\\'enroll_status\\\' => \\\'OPT_IN\\\')\')'),
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createAdCreative(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdLabel;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Label',
);
echo json_encode((new AdAccount($id))->createAdLabel(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'id',
'status',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getAdSets(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,45 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'A CPA Ad Set',
'campaign_id' => '<adCampaignLinkClicksID>',
'daily_budget' => '5000',
'start_time' => '2024-07-27T00:47:13-0700',
'end_time' => '2024-08-03T00:47:13-0700',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'REACH',
'bid_amount' => '1000',
'promoted_object' => array('page_id' => '<pageID>'),
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US'))),
'user_os' => 'iOS',
'publisher_platforms' => 'facebook',
'device_platforms' => 'mobile',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,43 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'A CPA Ad Set optimized for App Events',
'campaign_id' => '<adCampaignAppInstallsID>',
'daily_budget' => '300',
'start_time' => '2024-08-05T17:55:15-0700',
'end_time' => '2024-08-12T17:55:15-0700',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'OFFSITE_CONVERSIONS',
'bid_amount' => '100',
'status' => 'PAUSED',
'promoted_object' => array('application_id' => '<appID>','object_store_url' => '<appLink>','custom_event_type' => 'PURCHASE'),
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US')),'user_os' => array('iOS')),
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,39 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My AdSet',
'optimization_goal' => 'REACH',
'billing_event' => 'IMPRESSIONS',
'bid_amount' => '2',
'daily_budget' => '1000',
'campaign_id' => '<adCampaignConversionsID>',
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US')),'behaviors' => array(array('id' => 6007101597783,'name' => 'Business Travelers'),array('id' => 6004386044572,'name' => 'Android Owners (All)'))),
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,42 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Adset with bid multiplier',
'campaign_id' => '<adCampaignLinkClicksID>',
'daily_budget' => '3000',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'OFFSITE_CONVERSIONS',
'bid_amount' => '500',
'bid_adjustments' => array('user_groups' => array('gender' => array('male' => 0.8,'female' => 1))),
'promoted_object' => array('product_set_id' => '<productSetID>','custom_event_type' => 'ADD_TO_CART'),
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US'))),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,42 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First AdSet',
'lifetime_budget' => '20000',
'start_time' => '2024-07-27T00:46:29-0700',
'end_time' => '2024-08-03T00:46:29-0700',
'campaign_id' => '<adCampaignLinkClicksID>',
'bid_amount' => '500',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'POST_ENGAGEMENT',
'targeting' => array('age_min' => 20,'age_max' => 24,'behaviors' => array(array('id' => 6002714895372,'name' => 'All travelers')),'genders' => array(1),'geo_locations' => array('countries' => array('US'),'regions' => array(array('key' => '4081')),'cities' => array(array('key' => '777934','radius' => 10,'distance_unit' => 'mile'))),'interests' => array(array('id' => '<adsInterestID>','name' => '<adsInterestName>')),'life_events' => array(array('id' => 6002714398172,'name' => 'Newlywed (1 year)')),'facebook_positions' => array('feed'),'publisher_platforms' => array('facebook','audience_network')),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,39 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Ad Set',
'optimization_goal' => 'LINK_CLICKS',
'billing_event' => 'LINK_CLICKS',
'bid_amount' => '2',
'daily_budget' => '1000',
'campaign_id' => '<adCampaignLinkClicksID>',
'targeting' => array('device_platforms' => array('mobile'),'geo_locations' => array('countries' => array('US')),'publisher_platforms' => array('facebook','audience_network'),'facebook_positions' => array('feed')),
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,41 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Mobile App Installs Ad Set',
'daily_budget' => '1000',
'bid_amount' => '2',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'APP_INSTALLS',
'campaign_id' => '<adCampaignAppInstallsID>',
'promoted_object' => array('application_id' => '<appID>','object_store_url' => '<appLink>'),
'targeting' => array('device_platforms' => array('mobile'),'facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US')),'publisher_platforms' => array('facebook','audience_network'),'user_os' => array('IOS')),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,42 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Adset',
'daily_budget' => '2000',
'start_time' => '2024-07-29T17:54:47-0700',
'end_time' => '2024-08-05T17:54:47-0700',
'campaign_id' => '<adCampaignLinkClicksID>',
'bid_amount' => '100',
'billing_event' => 'LINK_CLICKS',
'optimization_goal' => 'LINK_CLICKS',
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US'))),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,41 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First AdSet',
'daily_budget' => '10000',
'bid_amount' => '300',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'REACH',
'campaign_id' => '<adCampaignLinkClicksID>',
'promoted_object' => array('page_id' => '<pageID>'),
'targeting' => array('facebook_positions' => array('feed'),'age_max' => 24,'age_min' => 20,'behaviors' => array(array('id' => 6002714895372,'name' => 'All travelers')),'device_platforms' => array('mobile'),'genders' => array(1),'geo_locations' => array('countries' => array('US'),'regions' => array(array('key' => '4081')),'cities' => array(array('key' => 777934,'radius' => 10,'distance_unit' => 'mile'))),'interests' => array(array('id' => '<adsInterestID>','name' => '<adsInterestName>')),'life_events' => array(array('id' => 6002714398172,'name' => 'Newlywed (1 year)')),'publisher_platforms' => array('facebook','audience_network')),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,41 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First AdSet',
'daily_budget' => '10000',
'bid_amount' => '300',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'REACH',
'campaign_id' => '<adCampaignLinkClicksID>',
'promoted_object' => array('page_id' => '<pageID>'),
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US'),'regions' => array(array('key' => '4081')),'cities' => array(array('key' => 777934,'radius' => 10,'distance_unit' => 'mile'))),'genders' => array(1),'age_max' => 24,'age_min' => 20,'publisher_platforms' => array('facebook','audience_network'),'device_platforms' => array('mobile'),'flexible_spec' => array(array('interests' => array(array('id' => '<adsInterestID>','name' => '<adsInterestName>'))))),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,42 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Adset',
'lifetime_budget' => '20000',
'start_time' => '2024-07-29T17:54:57-0700',
'end_time' => '2024-08-08T17:54:57-0700',
'campaign_id' => '<adCampaignLinkClicksID>',
'bid_amount' => '100',
'billing_event' => 'LINK_CLICKS',
'optimization_goal' => 'LINK_CLICKS',
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US')),'publisher_platforms' => array('facebook','audience_network')),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,42 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Adset',
'lifetime_budget' => '20000',
'start_time' => '2024-07-29T17:55:06-0700',
'end_time' => '2024-08-08T17:55:06-0700',
'campaign_id' => '<adCampaignLinkClicksID>',
'bid_amount' => '500',
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'POST_ENGAGEMENT',
'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US'),'regions' => array(array('key' => '4081')),'cities' => array(array('key' => 777934,'radius' => 10,'distance_unit' => 'mile'))),'genders' => array(1),'age_max' => 24,'age_min' => 20,'behaviors' => array(array('id' => 6002714895372,'name' => 'All travelers')),'life_events' => array(array('id' => 6002714398172,'name' => 'Newlywed (1 year)')),'publisher_platforms' => array('facebook'),'device_platforms' => array('desktop')),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,41 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Reach Ad Set',
'optimization_goal' => 'REACH',
'billing_event' => 'IMPRESSIONS',
'bid_amount' => '2',
'daily_budget' => '1000',
'campaign_id' => '<adCampaignLinkClicksID>',
'targeting' => array('geo_locations' => array('countries' => array('US')),'facebook_positions' => array('feed')),
'status' => 'PAUSED',
'promoted_object' => array('page_id' => '<pageID>'),
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,40 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My AdSet',
'optimization_goal' => 'REACH',
'billing_event' => 'IMPRESSIONS',
'bid_amount' => '2',
'daily_budget' => '1000',
'campaign_id' => '<adCampaignLinkClicksID>',
'targeting' => array('geo_locations' => array('countries' => array('US')),'publisher_platforms' => array('facebook'),'facebook_positions' => array('feed')),
'promoted_object' => array('page_id' => '<pageID>'),
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,41 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Reach Ad Set',
'optimization_goal' => 'REACH',
'billing_event' => 'IMPRESSIONS',
'bid_amount' => '2',
'daily_budget' => '1000',
'campaign_id' => '<adCampaignLinkClicksID>',
'targeting' => array('excluded_geo_locations' => array('regions' => array(array('key' => '3847'))),'geo_locations' => array('countries' => array('US')),'facebook_positions' => array('feed')),
'status' => 'PAUSED',
'promoted_object' => array('page_id' => '<pageID>'),
);
echo json_encode((new AdAccount($id))->createAdSet(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdVideo;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'source' => '<videoPath>',
);
echo json_encode((new AdAccount($id))->createAdVideo(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'id',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getAds(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdsPixel;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADS_PIXEL_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'code',
);
$params = array(
);
echo json_encode((new AdsPixel($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdsPixel;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My WCA Pixel',
);
echo json_encode((new AdAccount($id))->createAdsPixel(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Ad',
'adset_id' => '<adSetID>',
'creative' => array('creative_id' => '<adCreativeID>'),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAd(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My AdGroup with Redownload',
'adset_id' => '<adSetID>',
'creative' => array('creative_id' => '<adCreativeID>'),
'redownload' => '1',
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAd(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My AdGroup',
'adset_id' => '<adSetID>',
'creative' => array('creative_id' => '<adCreativeID>'),
'status' => 'PAUSED',
'authorization_category' => 'POLITICAL',
);
echo json_encode((new AdAccount($id))->createAd(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Ad',
'adset_id' => '<adSetID>',
'creative' => array('creative_id' => '<adCreativeID>'),
'tracking_specs' => array('action.type' => 'post_engagement','post' => '<postID>','page' => '<pageID>'),
'status' => 'PAUSED',
);
echo json_encode((new AdAccount($id))->createAd(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'objective',
);
$params = array(
'effective_status' => array('ACTIVE','PAUSED'),
);
echo json_encode((new AdAccount($id))->getCampaigns(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,156 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My campaign',
'objective' => 'OUTCOME_TRAFFIC',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'Lead generation campaign',
'objective' => 'OUTCOME_LEADS',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'Local ad campaign',
'objective' => 'OUTCOME_AWARENESS',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'Mobile App Installs Campaign',
'objective' => 'OUTCOME_APP_PROMOTION',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'App Installs Campaign with Dynamic Product Ads',
'objective' => 'OUTCOME_APP_PROMOTION',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'Video Views campaign',
'objective' => 'OUTCOME_ENGAGEMENT',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'My First Campaign',
'objective' => 'OUTCOME_ENGAGEMENT',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'My First Campaign',
'objective' => 'OUTCOME_ENGAGEMENT',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'My First Campaign with daily budget',
'objective' => 'OUTCOME_LEADS',
'status' => 'PAUSED',
'daily_budget' => '1000',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);
$fields = array(
);
$params = array(
'name' => 'My First Campaign with special ad categories',
'objective' => 'OUTCOME_LEADS',
'status' => 'PAUSED',
'daily_budget' => '1000',
'special_ad_categories' => array(),
'special_ad_category_country' => array('MX'),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,38 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Campaign with special ad categories',
'objective' => 'OUTCOME_LEADS',
'status' => 'PAUSED',
'daily_budget' => '1000',
'special_ad_categories' => array(),
'special_ad_category_country' => array('MX'),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Campaign with daily budget',
'objective' => 'OUTCOME_LEADS',
'status' => 'PAUSED',
'daily_budget' => '1000',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Lead generation campaign',
'objective' => 'OUTCOME_LEADS',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My campaign',
'objective' => 'OUTCOME_TRAFFIC',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Local ad campaign',
'objective' => 'OUTCOME_AWARENESS',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Mobile App Installs Campaign',
'objective' => 'OUTCOME_APP_PROMOTION',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'App Installs Campaign with Dynamic Product Ads',
'objective' => 'OUTCOME_APP_PROMOTION',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Campaign',
'objective' => 'OUTCOME_ENGAGEMENT',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My First Campaign',
'objective' => 'OUTCOME_ENGAGEMENT',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Video Views campaign',
'objective' => 'OUTCOME_ENGAGEMENT',
'status' => 'PAUSED',
'special_ad_categories' => array(),
);
echo json_encode((new AdAccount($id))->createCampaign(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'id',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getCustomAudiences(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'data_source',
'subtype',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getCustomAudiences(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My new Custom Audience',
'subtype' => 'CUSTOM',
'description' => 'People who purchased on my website',
'customer_file_source' => 'USER_PROVIDED_ONLY',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Test Value-Based lookalike from Pixel',
'subtype' => 'LOOKALIKE',
'lookalike_spec' => array('origin_event_sources' => array(array('id' => '<sourceID>','event_names' => array('AddToCart'))),'type' => 'custom_ratio','ratio' => 0.01,'country' => 'US'),
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Test Value-Based lookalike from Pixel',
'subtype' => 'LOOKALIKE',
'lookalike_spec' => array('origin_event_sources' => array(array('id' => '<sourceID>')),'type' => 'custom_ratio','ratio' => 0.01,'country' => 'US'),
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Test Website Custom Audience',
'rule' => array('inclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<appID>','type' => 'app')),'retention_seconds' => 8400,'filter' => array('operator' => 'and','filters' => array(array('field' => 'event','operator' => 'eq','value' => 'fb_mobile_purchase'))))))),
'prefill' => '1',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Test Engagement Custom Audience',
'rule' => array('inclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<pageID>','type' => 'page')),'retention_seconds' => 31536000,'filter' => array('operator' => 'and','filters' => array(array('field' => 'event','operator' => 'eq','value' => 'page_engaged')))))),'exclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<pageID>','type' => 'page')),'retention_seconds' => 31536000,'filter' => array('operator' => 'and','filters' => array(array('field' => 'event','operator' => 'eq','value' => 'page_cta_clicked'))))))),
'prefill' => '1',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Test Engagement Custom Audience',
'rule' => array('inclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<pageID>','type' => 'page')),'retention_seconds' => 31536000,'filter' => array('operator' => 'and','filters' => array(array('field' => 'event','operator' => 'eq','value' => 'page_engaged'),array('field' => 'event','operator' => 'eq','value' => 'page_engaged'))))))),
'prefill' => '1',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Test Engagement Custom Audience',
'rule' => array('inclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<pageID>','type' => 'page'),array('id' => '<pageID2>','type' => 'page')),'retention_seconds' => 31536000,'filter' => array('operator' => 'and','filters' => array(array('field' => 'event','operator' => 'eq','value' => 'page_engaged'))))))),
'prefill' => '1',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Test Engagement Custom Audience',
'rule' => array('inclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<pageID>','type' => 'page')),'retention_seconds' => 31536000,'filter' => array('operator' => 'and','filters' => array(array('field' => 'event','operator' => 'eq','value' => 'page_engaged'))))))),
'prefill' => '1',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My Test Website Custom Audience',
'rule' => array('inclusions' => array('operator' => 'or','rules' => array(array('event_sources' => array(array('id' => '<pixelID>','type' => 'pixel')),'retention_seconds' => 8400,'filter' => array('operator' => 'and','filters' => array(array('field' => 'url','operator' => 'i_contains','value' => 'shoes'))))))),
'prefill' => '1',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Value-Based Custom Audience',
'subtype' => 'CUSTOM',
'is_value_based' => '1',
'customer_file_source' => 'PARTNER_PROVIDED_ONLY',
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Value-Based lookalike',
'subtype' => 'LOOKALIKE',
'origin_audience_id' => '<valueBasedCustomAudienceID>',
'lookalike_spec' => array('type' => 'custom_ratio','ratio' => 0.01,'country' => 'US'),
);
echo json_encode((new AdAccount($id))->createCustomAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'creative' => '<adCreativeSpec>',
'ad_format' => '<adFormat>',
);
echo json_encode((new AdAccount($id))->getGeneratePreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'creative' => array('object_story_id' => '<pageID>_<postID>'),
'ad_format' => 'DESKTOP_FEED_STANDARD',
);
echo json_encode((new AdAccount($id))->getGeneratePreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'creative' => array('instagram_actor_id' => '<instagramActorID>','object_story_spec' => array('link_data' => array('call_to_action' => array('type' => 'LEARN_MORE','value' => array('link' => '<url>')),'caption' => 'www.example.com','image_hash' => '<imageHash>','link' => '<url>','message' => 'Message'),'page_id' => '<pageID>')),
'ad_format' => 'INSTAGRAM_STANDARD',
);
echo json_encode((new AdAccount($id))->getGeneratePreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'creative' => array('object_story_spec' => array('link_data' => array('call_to_action' => array('type' => 'USE_APP','value' => array('link' => '<url>')),'description' => 'Description','link' => '<url>','message' => 'Message','name' => 'Name','picture' => '<imageURL>'),'page_id' => '<pageID>')),
'ad_format' => 'MOBILE_FEED_STANDARD',
);
echo json_encode((new AdAccount($id))->getGeneratePreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Test Iphone Product Audience',
'product_set_id' => '<productSetID>',
'inclusions' => array(array('retention_seconds' => 86400,'rule' => array('and' => array(array('event' => array('eq' => 'AddToCart')),array('userAgent' => array('i_contains' => 'iPhone')))))),
'exclusions' => array(array('retention_seconds' => 172800,'rule' => array('event' => array('eq' => 'Purchase')))),
);
echo json_encode((new AdAccount($id))->createProductAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\CustomAudience;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'Test Product Audience',
'product_set_id' => '<productSetID>',
'inclusions' => array(array('retention_seconds' => 86400,'rule' => array('event' => array('eq' => 'AddToCart'))),array('retention_seconds' => 72000,'rule' => array('event' => array('eq' => 'ViewContent')))),
'exclusions' => array(array('retention_seconds' => 172800,'rule' => array('event' => array('eq' => 'Purchase')))),
);
echo json_encode((new AdAccount($id))->createProductAudience(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdAccountReachEstimate;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'targeting_spec' => array('geo_locations' => array('countries' => array('US')),'age_min' => 20,'age_max' => 40),
);
echo json_encode((new AdAccount($id))->getReachEstimate(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'id',
);
$params = array(
);
echo json_encode((new AdSet($id))->getAds(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Campaign;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CAMPAIGN_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
);
$params = array(
);
echo json_encode((new Campaign($id))->getAds(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Campaign;
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CAMPAIGN_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
);
$params = array(
'effective_status' => array('ARCHIVED'),
);
echo json_encode((new Campaign($id))->getAds(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Campaign;
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CAMPAIGN_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'start_time',
'end_time',
'daily_budget',
'lifetime_budget',
);
$params = array(
);
echo json_encode((new Campaign($id))->getAdSets(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'adset_schedule',
);
$params = array(
);
echo json_encode((new AdSet($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'status',
);
$params = array(
);
echo json_encode((new AdSet($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'id',
'name',
'start_time',
'end_time',
);
$params = array(
'date_format' => 'U',
);
echo json_encode((new AdSet($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'bid_adjustments' => array('user_groups' => array('user_bucket' => array('event_sources' => array('<pixelID>','<appID>'),'1' => 0.1,'2' => 0.2,'3' => 0.3,'default' => array('gender' => array('male' => 0.99,'female' => 0.12))))),
);
echo json_encode((new AdSet($id))->updateSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'billing_event' => 'IMPRESSIONS',
'optimization_goal' => 'LINK_CLICKS',
'bid_amount' => '200',
'targeting' => array('geo_locations' => array('countries' => array('US')),'facebook_positions' => array('feed')),
);
echo json_encode((new AdSet($id))->updateSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'asset_feed_spec',
);
$params = array(
);
echo json_encode((new AdCreative($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'object_story_id',
);
$params = array(
);
echo json_encode((new AdCreative($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'instagram_permalink_url',
);
$params = array(
);
echo json_encode((new AdCreative($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'ad_format' => 'DESKTOP_FEED_STANDARD',
'product_item_ids' => array('<productItemID>'),
);
echo json_encode((new AdCreative($id))->getPreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'ad_format' => 'DESKTOP_FEED_STANDARD',
);
echo json_encode((new AdCreative($id))->getPreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'ad_format' => 'DESKTOP_FEED_STANDARD',
'product_item_ids' => array('<productItemID>'),
);
echo json_encode((new AdCreative($id))->getPreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdPreview;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CREATIVE_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'ad_format' => 'DESKTOP_FEED_STANDARD',
'product_item_ids' => array('<productItemID>'),
'dynamic_customization' => array('language' => 'fr_XX','country' => 'FR'),
);
echo json_encode((new AdCreative($id))->getPreviews(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Object\AbstractObject;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
);
echo json_encode((new AdSet($id))->deleteSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Object\AbstractObject;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADGROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
);
echo json_encode((new Ad($id))->deleteSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Object\Lead;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_GROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
);
echo json_encode((new Ad($id))->getLeads(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Object\Lead;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_GROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'field_data',
'retailer_item_id',
);
$params = array(
);
echo json_encode((new Ad($id))->getLeads(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Object\Lead;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_GROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'filtering' => array(array('field' => 'time_created','operator' => 'GREATER_THAN','value' => 1721709809)),
);
echo json_encode((new Ad($id))->getLeads(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADGROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'id',
'name',
);
$params = array(
);
echo json_encode((new Ad($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADGROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My New Ad',
);
echo json_encode((new Ad($id))->updateSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADGROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'name' => 'My New Ad with Label',
'adlabels' => array(array('id' => '<adLabelID>','name' => 'My Label')),
);
echo json_encode((new Ad($id))->updateSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADGROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'adgroup_status' => 'PAUSED',
);
echo json_encode((new Ad($id))->updateSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\AdSet;
use FacebookAds\Object\AdsInsights;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_SET_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'impressions',
);
$params = array(
'breakdown' => 'publisher_platform',
);
echo json_encode((new AdSet($id))->getInsights(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,34 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Ad;
use FacebookAds\Object\AdsInsights;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<ADGROUP_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'impressions',
);
$params = array(
'date_preset' => 'last_7d',
);
echo json_encode((new Ad($id))->getInsights(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
require __DIR__ . '/vendor/autoload.php';
use FacebookAds\Object\Campaign;
use FacebookAds\Object\AdsInsights;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_CAMPAIGN_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'impressions',
'ad_id',
);
$params = array(
'level' => 'ad',
);
echo json_encode((new Campaign($id))->getInsights(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

Some files were not shown because too many files have changed in this diff Show More