first commit
This commit is contained in:
150
modules/ps_facebook/vendor/facebook/php-business-sdk/CHANGELOG.md
vendored
Normal file
150
modules/ps_facebook/vendor/facebook/php-business-sdk/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
|
||||
## Unreleased
|
||||
|
||||
## v11.0.0
|
||||
|
||||
|
||||
### Changed
|
||||
- Graph API call upgrade to [v11.0]https://developers.facebook.com/docs/graph-api/changelog/version11.0
|
||||
|
||||
## v10.0.1
|
||||
|
||||
### Added
|
||||
- Support for sending multiple values for certain UserData parameters to Conversions API.
|
||||
|
||||
|
||||
## v10.0.0
|
||||
|
||||
|
||||
### Changed
|
||||
- Graph API call upgrade to [v10.0](https://developers.facebook.com/docs/graph-api/changelog/version10.0)
|
||||
|
||||
## v9.0.2
|
||||
|
||||
|
||||
### Added
|
||||
- `action_source` field to Event for Conversions API.
|
||||
|
||||
### Fixed
|
||||
- `opt_out` field was being removed when set to false for Conversions API.
|
||||
|
||||
## v9.0.0
|
||||
### Changed
|
||||
- Graph API call upgrade to [v9.0](https://developers.facebook.com/docs/graph-api/changelog/version9.0)
|
||||
|
||||
### Added
|
||||
- `delivery_category` field to Content for Conversions API.
|
||||
|
||||
### Changed
|
||||
- Add empty to the list of reserved keywords.
|
||||
- Change empty value enum name in AdsPixelFirstPartyCookieStatusValues and AdsPixelDataUseSettingValues
|
||||
|
||||
## v8.0.3
|
||||
|
||||
### Changed
|
||||
- Fixed a normalization issue for zero values in CustomData in Conversions API
|
||||
- Start passing in the appsecret_proof to Conversions API custom http_clients when an appsecret is set
|
||||
- A Conversions API EventRequest custom http_client must now be an object instead of a class name
|
||||
|
||||
## v8.0.2
|
||||
|
||||
### Added
|
||||
- Added batching support to Conversions API. Create batched event requests by using BatchProcessor.
|
||||
|
||||
### Added
|
||||
- `lead_id` field to the Conversions API `user_data` section.
|
||||
- Added HttpServiceInterface to enable the default request object to be overridden by a user-defined HTTP Request Service class. Can be used to create Conversions API event requests.
|
||||
|
||||
## v8.0.1
|
||||
|
||||
### Added
|
||||
- Added async support to Conversions API - Create event request promises by using EventRequestAsync.
|
||||
|
||||
## v8.0.0
|
||||
|
||||
### Changed
|
||||
- Graph API call upgrade to [v8.0](https://developers.facebook.com/docs/graph-api/changelog/version8.0)
|
||||
|
||||
### Added
|
||||
- `delivery_category` field in custom_data section for Conversions API(formerly Serverside API).
|
||||
|
||||
## v7.0.2
|
||||
### Added
|
||||
- Added support for data processing options in Serverside API. For more details see : https://developers.facebook.com/docs/marketing-apis/data-processing-options
|
||||
|
||||
## v7.0.0
|
||||
### Changed
|
||||
- Graph API call upgrade to [v7.0](https://developers.facebook.com/docs/graph-api/changelog/version7.0)
|
||||
|
||||
## v6.0.2
|
||||
### Added
|
||||
- Add support for custom properties in the Server-Side API
|
||||
|
||||
## v6.0.0
|
||||
### Changed
|
||||
- Graph API call upgrade to [v6.0](https://developers.facebook.com/docs/graph-api/changelog/version6.0)
|
||||
|
||||
## v5.0.5
|
||||
### Added
|
||||
- Server-side API added search_string to CustomData and fixed setLastName in UserData object.
|
||||
|
||||
## v5.0.3
|
||||
### Added
|
||||
- Added function `getHeaders` in RequestException class which provides header information
|
||||
### Fixed
|
||||
- Server Side API CustomData model normalization fix
|
||||
|
||||
## v5.0.2
|
||||
|
||||
### Added
|
||||
- Added `CrashRepoter`, more context available [here](https://developers.facebook.com/docs/business-sdk/guides/crash-reports)
|
||||
|
||||
## v5.0.1
|
||||
### Added
|
||||
- Added strongly typed Server-Side API for Web (https://developers.facebook.com/docs/marketing-api/facebook-pixel/server-side-api/using-the-api)
|
||||
|
||||
## v5.0.0
|
||||
### Changed
|
||||
- Graph API call upgrade to [v5.0](https://developers.facebook.com/docs/graph-api/changelog/version5.0)
|
||||
|
||||
## v4.0.6
|
||||
|
||||
### Fixed
|
||||
- Add back `source` param in `Adaccount->createAdVideo`.
|
||||
|
||||
## v4.0.5
|
||||
|
||||
### Fixed
|
||||
- Introduce `addUsersMultiKey` and `removeUsersMultiKey` in `CustomAudience` to still allow add users to `CustomAudience` with multiple keys after `CustomAudienceMultiKey` been deprecated.
|
||||
|
||||
## v4.0.0
|
||||
### Changed
|
||||
- Graph API call upgrade to [v4.0](https://developers.facebook.com/docs/graph-api/changelog/version4.0)
|
||||
|
||||
## v3.3.1
|
||||
### Changed
|
||||
- Remove list of API call from Business SDK, any [these APIs](https://developers.facebook.com/docs/graph-api/changelog/4-30-2019-endpoint-deprecations) included in Business SDK will be deprecated.
|
||||
|
||||
## v3.3.0
|
||||
### Changed
|
||||
- Graph API call upgrade to [v3.3](https://developers.facebook.com/docs/graph-api/changelog/version3.3)
|
||||
### Deprecated
|
||||
- Deprecated `parentID` in `AbstractCrudObject`.
|
||||
- Deprecated `CustomAudienceMultiKey`, use class `CustomAudience` instead.
|
||||
- Deprecated functions `create`, `read`, `update` in `AbstractCrudObject`. Check out our [recommended way](https://github.com/facebook/facebook-php-business-sdk#object-classes) to make API call.
|
||||
***`read` will reset the object fields, while `getSelf` will get a new object.*** For example :
|
||||
```
|
||||
$async_job = $adaccount->getInsightsAsync($fields, $params);
|
||||
|
||||
$async_job = $async_job->getSelf();
|
||||
|
||||
while (!$async_job->isComplete()) {
|
||||
sleep(1);
|
||||
$async_job = $async_job->getSelf();
|
||||
}
|
||||
```
|
||||
|
||||
3
modules/ps_facebook/vendor/facebook/php-business-sdk/CODE_OF_CONDUCT.md
vendored
Normal file
3
modules/ps_facebook/vendor/facebook/php-business-sdk/CODE_OF_CONDUCT.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Code of Conduct
|
||||
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
45
modules/ps_facebook/vendor/facebook/php-business-sdk/CONTRIBUTING.md
vendored
Normal file
45
modules/ps_facebook/vendor/facebook/php-business-sdk/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Contributing to Facebook Ads API SDK for PHP
|
||||
We want to make contributing to this project as easy and transparent as
|
||||
possible.
|
||||
|
||||
## Code of Conduct
|
||||
The code of conduct is described in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)
|
||||
|
||||
## Our Development Process
|
||||
The Facebook Ads API SDK for PHP is currently developed in Facebook's internal
|
||||
repositories and then exported out to GitHub by a Facebook team member. We invite
|
||||
you to submit pull requests directly to GitHub and, after review, these can be
|
||||
merged into the project.
|
||||
|
||||
## Pull Requests
|
||||
We actively welcome your pull requests.
|
||||
|
||||
1. Fork the repo and create your branch from `main`.
|
||||
2. If you've added code that should be tested, add tests.
|
||||
3. If you've changed APIs, update the documentation.
|
||||
4. Ensure the test suite passes.
|
||||
5. Make sure your code lints.
|
||||
6. If you haven't already, complete the Contributor License Agreement ("CLA").
|
||||
|
||||
## Contributor License Agreement ("CLA")
|
||||
In order to accept your pull request, we need you to submit a CLA. You only need
|
||||
to do this once to work on any of Facebook's open source projects.
|
||||
|
||||
Complete your CLA [here](https://code.facebook.com/cla)
|
||||
|
||||
## Issues
|
||||
Since we want to handle bugs more efficiently, we encourage you report bug to
|
||||
our dedicated bug reporting channel. If you encounter a bug with Business SDK
|
||||
(PHP), please report the issue at
|
||||
[our developer bug reporting channel](https://developers.facebook.com/support/bugs/).
|
||||
|
||||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
|
||||
disclosure of security bugs. In those cases, please go through the process
|
||||
outlined on that page
|
||||
|
||||
## Coding Style
|
||||
Please follow [PHP Coding Standards](https://secure.phabricator.com/book/phabcontrib/article/php_coding_standards/)
|
||||
|
||||
## License
|
||||
By contributing to Facebook Ads API SDK for PHP, you agree that your contributions
|
||||
will be licensed under the LICENSE file in the root directory of this source tree.
|
||||
495
modules/ps_facebook/vendor/facebook/php-business-sdk/DEVELOPER_GUIDE.md
vendored
Normal file
495
modules/ps_facebook/vendor/facebook/php-business-sdk/DEVELOPER_GUIDE.md
vendored
Normal file
@@ -0,0 +1,495 @@
|
||||
# Facebook Ads SDK - Developer Guide
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide assumes you have an app that has been whitelisted for the Facebook Ads API, that you have a fully working development environment with all required dependencies and that are ready to start coding. If you haven't done this, please see the [README](./README.md) file.
|
||||
|
||||
We also assume you are somewhat familiar with namespaces in PHP. If not, we recommend you take some time to read the [namespace basics](http://www.php.net/manual/en/language.namespaces.basics.php) in the PHP Manual.
|
||||
|
||||
You should also have the documentation for the [Facebook Marketing APIs](https://developers.facebook.com/docs/ads-api) available as you will need to refer to this to understand which combination of parameters are required for the different object types.
|
||||
|
||||
## Bootstrapping <a name="bootstrapping"></a>
|
||||
The classes within the Facebook Ads SDK are designed to be included using an autoloader compliant with the [PSR-4](http://www.php-fig.org/psr/psr-4/). If you are using [Composer](https://getcomposer.org/) to include dependencies, you will find an implementation available within the vendor folder. This guide assumes you are using this autoloader.
|
||||
|
||||
```php
|
||||
<?php
|
||||
define('VENDOR_DIR', '/path/to/sdk/'); // Path to the Vendor directory
|
||||
$loader = include VENDOR_DIR.'/vendor/autoload.php';
|
||||
```
|
||||
|
||||
### Authentication <a name="authentication"></a>
|
||||
To make any request to the Ads API, you will need to have a valid access token and the user has accepted the `ads_management` permission.
|
||||
|
||||
## The Api Object
|
||||
|
||||
The `FacebookAds\Api` object is the basis of the Ads SDK which encapsulates a `FacebookAds\Session` and is used to execute requests against the Graph API.
|
||||
|
||||
An easy to use init method is provided:
|
||||
|
||||
```php
|
||||
use FacebookAds\Api;
|
||||
|
||||
// Set the default application to be used with this session and register an instance of the Api object
|
||||
Api::init('<APP_ID>', '<APP_SECRET>', '<ACCESS_TOKEN>');
|
||||
|
||||
// The instace is now retrivable
|
||||
$api = Api::instance();
|
||||
```
|
||||
|
||||
### Making requests to the Graph <a name="making_requests"></a>
|
||||
|
||||
Generally you should not need to make requests to the Graph API directly as these calls are handled by the implementation of objects within the SDK. However, there may be some case where you do want to query the Graph directly. In this case, you can use the `call` method of the `Api` class which returns a `FacebookAds\Http\RequestInterface`, by default the registered class is `FacebookAds\Http\Request`:
|
||||
|
||||
```php
|
||||
$response = $api->call(
|
||||
'/61405622',
|
||||
Api::HTTP_METHOD_GET,
|
||||
array('fields'=>'name')
|
||||
);
|
||||
var_dump($response->getContent());
|
||||
```
|
||||
|
||||
### Handling Multiple Access Tokens <a name="multiple_tokens"></a>
|
||||
The first time an `Api` object is instantiated, we store a static reference to that object within the `Api` class and this is used as the default instance within the SDK. This saves you from having to pass around a reference to an `Api` instance within your application.
|
||||
|
||||
A common requirement amongst Facebook Ads API developers however is to be able to handle multiple sessions within a single script execution. For example, you may have a process which syncs updated objects for multiple app users into some local datastore.
|
||||
|
||||
To enable this, we provide two ways to manage sessions.
|
||||
|
||||
The first is by mutating the default instance used by the application. The default instance can be accessed using the method `Api::instance()`. You can also change the default instance using the static method `Api::setInstance($api)`.
|
||||
|
||||
The second is to explicitly define the `Api` instance you want to use when querying the Graph. This is achieved by passing an instance to the constructor of any class that extends from `Object\AbstractCrudObject`.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Ad;
|
||||
$my_ad = new Ad($id, $parent_id=null, $api);
|
||||
```
|
||||
|
||||
## Objects Types
|
||||
|
||||
|
||||
### CRUD Objects
|
||||
For any entity that can be directly queried from the Graph API we have provided classes which extend `Object\AbstractCrudObject`. This provides `create`, `read`, `update` and `delete` methods for the majority of these entities. However, in some cases the Graph API does not support all of these operations and you will receive an `\Exception` if you attempt to call an unsupported method.
|
||||
|
||||
When setting class variables on an object of this type we perform some basic validation to ensure the field is a valid field and an `\Exception` will be thrown if a field name is not found within the [field definition](#field_definition) for that class.
|
||||
|
||||
### Simple Objects
|
||||
There is another set of entities which cannot be directly queried from the Graph such as an `AdPreview`. This type of object extends `Object\AbstractObject` which provides methods to access the response data.
|
||||
|
||||
### Field definitions <a name="field_definition"></a>
|
||||
|
||||
For each object type, we provide a class enumerating the available fields of that object. These can be found within the `FacebookAds\Object\Fields` namespace and provide a way to reference fields without using strings. You can alternatively use strings if you find this easier.
|
||||
|
||||
For example, you can set the data of an object using the field definitions in the following way:
|
||||
|
||||
```php
|
||||
$someObject->setData(array(
|
||||
MyObjectFields::ID => 1234,
|
||||
MyObjectFields::NAME => 'My Name',
|
||||
));
|
||||
```
|
||||
|
||||
Alternatively, you can use the string equivalent:
|
||||
|
||||
```php
|
||||
$someObject->setData(array(
|
||||
'id'=>1234,
|
||||
'name'=>'My Name',
|
||||
));
|
||||
```
|
||||
|
||||
Similarly the same applies for direct assignation:
|
||||
|
||||
```php
|
||||
//Using field definitions:
|
||||
$someObject->{SomeObjectFields::ID} = 123;
|
||||
|
||||
//Equivalent to using the variable name directly:
|
||||
$someObject->id = 123;
|
||||
```
|
||||
|
||||
### The Cursor Class
|
||||
When requesting multiple objects from the Graph, responses may be returned in pages of data which can be traversed using cursors. We encapsulate this information into a `Cursor` class which represents the set of objects in the current page along with information about how to access subsequent pages of objects. This class implements the `\Iterable` and `\Countable` interfaces.
|
||||
|
||||
## Reading Objects
|
||||
|
||||
### Reading a single object
|
||||
To read an object from the Graph you will need its `id`. By default, only the `id` field of an object is queried and you should specify when reading an object the fields you need. It is not recommended that you request all fields unless you require them all.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\AdAccountFields;
|
||||
|
||||
$required_fields = array(
|
||||
AdAccountFields::ID,
|
||||
AdAccountFields::NAME,
|
||||
AdAccountFields::DAILY_SPEND_LIMIT,
|
||||
);
|
||||
|
||||
$adaccount = (new AdAccount($id))->read($required_fields);
|
||||
```
|
||||
See [Defining Default Fields](#default_fields) within the section about Extending the SDK for an example of how to avoid defining the fields you require every request.
|
||||
|
||||
|
||||
### Reading multiple objects
|
||||
We provide the static method `readIds($ids = array(...), $fields = array(...))` to enable you to request many objects of a single type and will return a `Cursor`:
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\AdAccountFields;
|
||||
|
||||
$required_fields = array(
|
||||
AdAccountFields::ID,
|
||||
AdAccountFields::NAME,
|
||||
AdAccountFields::DAILY_SPEND_LIMIT,
|
||||
);
|
||||
$account_ids = array('act_x', 'act_y'...)
|
||||
$adaccounts = AdAccount::readIds($account_ids, $required_fields);
|
||||
foreach($adaccounts as $account) {
|
||||
echo $account->id."\n";
|
||||
}
|
||||
```
|
||||
|
||||
## Creating Objects
|
||||
|
||||
When creating objects on the Graph, they are generally created by making a POST request to an edge of a parent object. For example, ads are created using the endpoint `https://graph.facebook.com/act_123123/ads`. Therefore when creating an object, you must know the `id` of the parent object which is generally the id of an AdAccount. You should consult the [Facebook Developer Documentation](https://developers.facebook.com/docs/ads-api) to see which parent object to use.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Ad;
|
||||
use FacebookAds\Object\Fields\AdFields;
|
||||
|
||||
$account_id = 'act_123123';
|
||||
$ad = new Ad($id=null, $account_id);
|
||||
|
||||
$ad->setData(array(
|
||||
AdFields::NAME => 'My Test Ad',
|
||||
AdFields::ADSET_ID => $adset_id,
|
||||
));
|
||||
|
||||
$ad->create(array(
|
||||
Ad::STATUS_PARAM_NAME => Ad::STATUS_PAUSED,
|
||||
));
|
||||
echo $ad->{AdFields::ID};
|
||||
```
|
||||
|
||||
## Updating Objects
|
||||
|
||||
When you mutate an AdObject, we record which variables have changed and make it easy for you to write these change to the Graph API by calling the `update` method.
|
||||
|
||||
Please note that in some cases the variable name used to update an attribute of an entity differs from the one read from Graph API. Any variable you change will be included in the request to update an object an you will likely receive an `\Exception` if the field name is incorrect. Please consult the [Facebook Developer Documentation](https://developers.facebook.com/docs/ads-api) to see which fields are required.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Ad;
|
||||
use FacebookAds\Object\Fields\AdFields;
|
||||
|
||||
$ad = new Ad($id);
|
||||
$ad->name = 'Updated Name';
|
||||
$ad->update();
|
||||
```
|
||||
|
||||
## Deleting Objects
|
||||
|
||||
|
||||
### Deleting a single object
|
||||
|
||||
To delete an object, you only need call the `delete` method on an instance of that object. Note, you do not have had to have read the object from the Graph API, all you need is the `id` of the object.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Ad;
|
||||
use FacebookAds\Object\Fields\AdFields;
|
||||
|
||||
$ad = new Ad($id);
|
||||
$ad->delete();
|
||||
```
|
||||
|
||||
### Deleting multiple objects
|
||||
|
||||
We provide the static method `deleteIds($ids = array(...))` to enable you to delete many objects at the same time. This method returns a boolean value and will only return `true` if all objects were successfully deleted. A return value of `false` means one or more failed to be deleted. Please also note that we do not verify the type of the `id` you have passed into this function.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Ad;
|
||||
$status = Ad::deleteIds($ids = array(...));
|
||||
```
|
||||
|
||||
### Save Helper
|
||||
|
||||
On object that extends `AbstractCrudObject` you can call the `save` method which will call `create` if the object does not have a value for `id` set, or will call `update` a value is present.
|
||||
|
||||
|
||||
## Connections
|
||||
|
||||
Objects on the Graph API may also have connections. A connection provides a way to retrieve objects which relate to the current object, for example, you can retrieve all the ads relative to an ad account using the URL `https://graph.facebook.com/act_123123/ads`.
|
||||
|
||||
For each connection an object has, we provide a helper method to retrieve its related objects. In the case of `ObjectObject\AdAccount` we provide several of these methods including `getAds($required_fields)` which will return a `Cursor` containing a page of `Object\Ad` objects.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
$account = new AdAccount($id);
|
||||
$ads = $account->getAds($fields = array('name')));
|
||||
foreach($ads as $ad) {
|
||||
echo $ad->name."\n";
|
||||
}
|
||||
```
|
||||
|
||||
You only need the `id` of the object on which you want to call a connection method, therefore you do not need to have read the object from the Graph API first.
|
||||
|
||||
For cases where these helper methods are not available, see [Requesting Connections Without Helper Methods](#generic_connections).
|
||||
|
||||
## Targeting <a name="targeting"></a>
|
||||
|
||||
Facebook's targeting can generally be broken down into [interests](https://developers.facebook.com/docs/reference/ads-api/interest-targeting), [demographics](https://developers.facebook.com/docs/reference/ads-api/demographic-targeting), [behaviors](https://developers.facebook.com/docs/reference/ads-api/behavior-targeting) and [geo targeting](https://developers.facebook.com/docs/reference/ads-api/targeting-specs/#location). Many of these need to be queried from the Graph API search endpoint.
|
||||
|
||||
To query targeting using the Ads SDK, you can use the `Object\TargetingSearch` class.
|
||||
|
||||
## Examples
|
||||
|
||||
This set of examples will walk you through:
|
||||
|
||||
1. Reading AdAccounts for a user
|
||||
* Creating a Campaign
|
||||
* Searching targeting criteria
|
||||
* Creating an AdSet
|
||||
* Creating an AdImage
|
||||
* Creating an AdCreative
|
||||
* Creating an Ad
|
||||
|
||||
Examples can be found within the `examples/` folder of the SDK. This assumes you have bootstrap code with an access token:
|
||||
|
||||
```php
|
||||
<?php
|
||||
define('SDK_DIR', '/path/to/sdk/'); // Path to the SDK directory
|
||||
|
||||
$loader = include SDK_DIR.'/vendor/autoload.php';
|
||||
|
||||
use FacebookAds\Api;
|
||||
|
||||
Api::init($app_id, $app_secret, $access_token);
|
||||
|
||||
```
|
||||
|
||||
### 1. Reading AdAccounts
|
||||
|
||||
The `FacebookSession` contains the `id` of the user who has the active session and this can be used to read their `AdAccount` connections.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdUser;
|
||||
use FacebookAds\Object\Fields\AdUserFields;
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\AdAccountFields;
|
||||
|
||||
$user = new AdUser('me');
|
||||
$user->read(array(AdUserFields::ID));
|
||||
|
||||
$accounts = $user->getAdAccounts(array(
|
||||
AdAccountFields::ID,
|
||||
AdAccountFields::NAME,
|
||||
));
|
||||
|
||||
// Print out the accounts
|
||||
echo "Accounts:\n";
|
||||
foreach($accounts as $account) {
|
||||
echo $account->id . ' - ' .$account->name."\n";
|
||||
}
|
||||
|
||||
// Grab the first account for next steps (you should probably choose one)
|
||||
$account = (count($accounts)) ? $accounts->getObjects()[0] : null;
|
||||
echo "\nUsing this account: ";
|
||||
echo $account->id."\n";
|
||||
```
|
||||
|
||||
### 2. Creating a Campaign
|
||||
|
||||
Now we have an `AdAccount` for the current user we can go ahead an create our [Campaign](https://developers.facebook.com/docs/reference/ads-api/adcampaign). All `ads` within your `campaign` should have the same objective. You can find the available objectives within the [`AdObjectives`](src/FacebookAds/Object/Values/AdObjectives.php) class.
|
||||
|
||||
In the following example we create a paused campaign so your ads do not go live, however you can omit the status field if you want your ad to run.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Campaign;
|
||||
use FacebookAds\Object\Fields\CampaignFields;
|
||||
use FacebookAds\Object\Values\AdObjectives;
|
||||
use FacebookAds\Object\Values\AdBuyingTypes;
|
||||
|
||||
$campaign = new Campaign(null, $account->id);
|
||||
$campaign->setData(array(
|
||||
CampaignFields::NAME => 'My First Campaign',
|
||||
CampaignFields::OBJECTIVE => AdObjectives::LINK_CLICKS,
|
||||
));
|
||||
|
||||
$campaign->create(array(
|
||||
Campaign::STATUS_PARAM_NAME => Campaign::STATUS_PAUSED,
|
||||
));
|
||||
echo "Campaign ID:".$campaign->id."\n";
|
||||
```
|
||||
|
||||
|
||||
### 3. Searching Targeting
|
||||
|
||||
The final thing we need before creating an `Ad` is some targeting. Many attributes of targeting can be found defined in the developer documentation, however some categories need you to search, such as interests. For this, we provide the `TargetingSearch` class.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\TargetingSearch;
|
||||
use FacebookAds\Object\Search\TargetingSearchTypes;
|
||||
|
||||
$results = TargetingSearch::search(
|
||||
$type = TargetingSearchTypes::INTEREST,
|
||||
$class = null,
|
||||
$query = 'facebook london',
|
||||
);
|
||||
|
||||
// we'll take the top result for now
|
||||
$target = (count($results)) ? $results->getObjects()[0] : null;
|
||||
echo "Using target: ".$target->name."\n";
|
||||
```
|
||||
|
||||
Targeting for the moment is expressed in the form of a multidimensional array:
|
||||
|
||||
```php
|
||||
$targeting = array(
|
||||
'geo_locations' => array(
|
||||
'countries' => array('GB'),
|
||||
),
|
||||
'interests' => array(
|
||||
array(
|
||||
'id' => $target->id,
|
||||
'name'=>$target->name,
|
||||
),
|
||||
),
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
### 4. Creating an AdSet
|
||||
|
||||
An [`AdSet`](https://developers.facebook.com/docs/reference/ads-api/adset) is a set of [`Ad`](https://developers.facebook.com/docs/reference/ads-api/adgroup) objects and it is best practice to ensure all `Ad` objects within an `AdSet` have the same targeting.
|
||||
|
||||
The `AdSet` holds the attributes about the duration of a campaign and the budget. When deciding a budget, you should also choose between `lifetime_budget` and `daily_budget`.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdSet;
|
||||
use FacebookAds\Object\Fields\AdSetFields;
|
||||
use FacebookAds\Object\Values\BillingEvents;
|
||||
use FacebookAds\Object\Values\OptimizationGoals;
|
||||
|
||||
$adset = new AdSet(null, $account->id);
|
||||
$adset->setData(array(
|
||||
AdSetFields::NAME => 'My First AdSet',
|
||||
AdSetFields::CAMPAIGN_ID => $campaign->id,
|
||||
AdSetFields::DAILY_BUDGET => '150',
|
||||
AdSetFields::OPTIMIZATION_GOAL => OptimizationGoals::REACH,
|
||||
AdSetFields::BILLING_EVENT => BillingEvents::IMPRESSIONS,
|
||||
AdSetFields::BID_AMOUNT => 2,
|
||||
AdSetFields::TARGETING => $targeting,
|
||||
AdSetFields::START_TIME =>
|
||||
(new \DateTime("+1 week"))->format(\DateTime::ISO8601),
|
||||
AdSetFields::END_TIME =>
|
||||
(new \DateTime("+2 week"))->format(\DateTime::ISO8601),
|
||||
));
|
||||
|
||||
$adset->create();
|
||||
echo 'AdSet ID: '.$adset->id."\n";
|
||||
```
|
||||
### 5. Create an AdImage
|
||||
|
||||
Now you have a `AdSet`, you will be able to create an `Ad`, however, first you will need to upload the image you want to use as part of the `AdCreative`.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdImage;
|
||||
use FacebookAds\Object\Fields\AdImageFields;
|
||||
|
||||
$image = new AdImage(null, $account->id);
|
||||
$image->filename = SDK_DIR.'/test/misc/FB-f-Logo__blue_512.png';
|
||||
|
||||
$image->create();
|
||||
echo 'Image Hash: '.$image->hash."\n";
|
||||
```
|
||||
|
||||
### 6. Creating an AdCreative
|
||||
|
||||
You can create an `AdCreative` in two ways. The first is by including a JSON object when creating an `Ad` and the second, which we will demonstrate here, is by explicitly creation an `AdCreative` and using its `id` when creating an `Ad`.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdCreative;
|
||||
use FacebookAds\Object\Fields\AdCreativeFields;
|
||||
|
||||
$creative = new AdCreative(null, $account->id);
|
||||
$creative->setData(array(
|
||||
AdCreativeFields::NAME => 'Sample Creative',
|
||||
AdCreativeFields::TITLE => 'Welcome to the Jungle',
|
||||
AdCreativeFields::BODY => 'We\'ve got fun \'n\' games',
|
||||
AdCreativeFields::IMAGE_HASH => $image->hash,
|
||||
AdCreativeFields::OBJECT_URL => 'http://www.example.com/',
|
||||
));
|
||||
|
||||
$creative->create();
|
||||
echo 'Creative ID: '.$creative->id . "\n";
|
||||
```
|
||||
|
||||
### 7. Creating an Ad
|
||||
|
||||
The final step is to create the [`Ad`](https://developers.facebook.com/docs/reference/ads-api/adgroup/). The `Ad` contains all of the information about bid, creative and targeting. It should also have the asme objective as the `Campaign` we created.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\Ad;
|
||||
use FacebookAds\Object\Fields\AdFields;
|
||||
|
||||
$ad = new Ad(null, $account->id);
|
||||
$ad->setData(array(
|
||||
AdFields::CREATIVE => array('creative_id' => $creative->id),
|
||||
AdFields::NAME => 'My First Ad',
|
||||
AdFields::ADSET_ID => $adset->id,
|
||||
));
|
||||
|
||||
$ad->create();
|
||||
echo 'Ad ID:'.$ad->id."\n";
|
||||
```
|
||||
## Extending the SDK
|
||||
|
||||
There are many scenarios in which you may want to extend the SDK, and when developing this SDK we attempted to balance extensibility with ease of use for new developers.
|
||||
|
||||
### Defining Default Fields to Read <a name="default_fields"></a>
|
||||
We noted earlier that by default no fields are requested when calling the `read` method of a class implementing `AbstractCrudObject`, however if you always require the same set of fields throughout your application we have provided a simple way to do this.
|
||||
|
||||
Within your own namespace, you can extend the any class implementing `AbstractCrudObject` and override the static variable `$defaultReadFields` to be an array of fields you want to be read by default. You should try to not change the classes in the SDK directly as this may break forward compatibly.
|
||||
|
||||
```php
|
||||
namespace MyNamespace\Object;
|
||||
|
||||
use FacebookAds\Object\Fields\AdAccountFields;
|
||||
|
||||
class AdAccount extends FacebookAds\Object\AdAccount {
|
||||
|
||||
protected static $defaultReadFields = array(
|
||||
AdAccountFields::ID,
|
||||
AdAccountFields::NAME,
|
||||
AdAccountFields::DAILY_SPEND_LIMIT,
|
||||
AdAccountFields::CURRENCY,
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Within your application, whenever you use an `AdAccount`, you should use the one within your namespace instead of the `FacebookAds` one.
|
||||
|
||||
```php
|
||||
use MyNamespace\Object\AdAccount;
|
||||
$adaccount = (new AdAccount($id))->read();
|
||||
echo $adaccount->name;
|
||||
```
|
||||
|
||||
### Requesting Connections Without Helper Methods<a name="generic_connections"></a>
|
||||
|
||||
As detailed in the [Connections](#connections) section, we provide helper methods to request objects relative to an object. However, in some cases these methods may not have been implemented, or if you have extended our based objects as in the example of [defining default fields to read](#default_fields), calling a connection helper method on a base object will return objects of the \FacebookAds namespace type.
|
||||
|
||||
In this case, you can use our generic connection methods to retrieve the correct type of object for any class extending `AbstractCrudObject`. To enable this, we provide two methods, `getOneByConnection` and `getManyByConnection` or which the latter is the most commonly used.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
|
||||
// Ad in your namespace which you have used to extend the
|
||||
// FacebookAds\Object\Ad class
|
||||
use MyNamespace\Object\Ad;
|
||||
|
||||
$account = new AdAccount($id);
|
||||
$my_adaccount_objects = $account->getManyByConnection(
|
||||
Ad::className(), $fields = array(...), $params = array(...));
|
||||
|
||||
```
|
||||
19
modules/ps_facebook/vendor/facebook/php-business-sdk/LICENSE
vendored
Normal file
19
modules/ps_facebook/vendor/facebook/php-business-sdk/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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.
|
||||
359
modules/ps_facebook/vendor/facebook/php-business-sdk/README.md
vendored
Normal file
359
modules/ps_facebook/vendor/facebook/php-business-sdk/README.md
vendored
Normal file
@@ -0,0 +1,359 @@
|
||||
# Facebook Business SDK for PHP
|
||||
|
||||
[](https://packagist.org/packages/facebook/php-business-sdk)
|
||||
[](https://github.com/facebook/facebook-php-business-sdk/blob/main/LICENSE)
|
||||
[](https://actions-badge.atrox.dev/facebook/facebook-php-business-sdk/goto?ref=main)
|
||||
[](https://scrutinizer-ci.com/g/facebook/facebook-php-business-sdk)
|
||||
[](https://scrutinizer-ci.com/g/facebook/facebook-php-business-sdk)
|
||||
|
||||
## Introduction
|
||||
|
||||
The Facebook <a href="https://developers.facebook.com/docs/business-sdk" target="_blank">Business SDK</a> is a one-stop shop to help our partners better serve their businesses. Partners are using multiple Facebook API's to server the needs of their clients. Adopting all these API's and keeping them up to date across the various platforms can be time consuming and ultimately prohibitive. For this reason Facebook has developed the Business SDK bundling many of its APIs into one SDK to ease implementation and upkeep. The Business SDK is an upgraded version of the Marketing API SDK that includes the Marketing API as well as many Facebook APIs from different platforms such as Pages, Business Manager, Instagram, etc.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Business SDK <a href="https://developers.facebook.com/docs/business-sdk/getting-started" target="_blank">Getting Started Guide</a>
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
### Register An App
|
||||
|
||||
To get started with the SDK, you must have an app
|
||||
registered on <a href="https://developers.facebook.com/" target="_blank">developers.facebook.com</a>.
|
||||
|
||||
To manage the Marketing API, please visit your
|
||||
<a href="https://developers.facebook.com/apps/<YOUR APP ID>/dashboard"> App Dashboard </a>
|
||||
and add the <b>Marketing API</b> product to your app.
|
||||
|
||||
**IMPORTANT**: For security, it is recommended that you turn on 'Require App Secret' in your app's Settings->Advanced page.
|
||||
|
||||
### Obtain An Access Token
|
||||
|
||||
When someone connects with an app using Facebook Login and approves the request
|
||||
for permissions, the app obtains an access token that provides temporary, secure
|
||||
access to Facebook APIs.
|
||||
|
||||
An access token is an opaque string that identifies a User, app, or Page.
|
||||
|
||||
For example, to access the Marketing API, you need to generate a User access token
|
||||
for your app and ask for the ``ads_management`` permission; to access Pages API,
|
||||
you need to generate a Page access token for your app and ask for the ``manage_page`` permission.
|
||||
|
||||
Refer to our
|
||||
<a href="https://developers.facebook.com/docs/facebook-login/access-tokens" target="_blank">
|
||||
Access Token Guide</a> to learn more.
|
||||
|
||||
For now, we can use the
|
||||
<a href="https://developers.facebook.com/tools/explorer" target="_blank">Graph Explorer</a>
|
||||
to get an access token.
|
||||
|
||||
## Installation
|
||||
|
||||
The Facebook Business SDK requires PHP 5.6 or greater.
|
||||
|
||||
### Composer
|
||||
|
||||
The Facebook Business SDK uses composer to manage dependencies. Visit the <a href="https://getcomposer.org/download/" target="_blank">composer documentation</a> to learn how to install composer.
|
||||
|
||||
Add the following to your `composer.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"facebook/php-business-sdk": "12.0.*"
|
||||
}
|
||||
}
|
||||
```
|
||||
then install it through composer:
|
||||
|
||||
```shell
|
||||
php composer.phar install --no-dev
|
||||
```
|
||||
|
||||
This SDK and its dependencies will be installed under `./vendor`.
|
||||
|
||||
### Alternatives
|
||||
|
||||
This repository is written following the [psr-4 autoloading standard](http://www.php-fig.org/psr/psr-4/). Any psr-4 compatible autoloader can be used.
|
||||
|
||||
## Usage
|
||||
|
||||
### Api main class
|
||||
|
||||
The `FacebookAds\Api` object is the foundation of the Business SDK which encapsulates a `FacebookAds\Session` and is used to execute requests against the Graph API.
|
||||
|
||||
To instantiate an Api object you will need a valid access token:
|
||||
```php
|
||||
use FacebookAds\Api;
|
||||
|
||||
// Initialize a new Session and instantiate an Api object
|
||||
Api::init($app_id, $app_secret, $access_token);
|
||||
|
||||
// The Api object is now available through singleton
|
||||
$api = Api::instance();
|
||||
|
||||
```
|
||||
|
||||
Once instantiated, the Api object will allow you to start making requests to the Graph API.
|
||||
|
||||
### Fields names
|
||||
|
||||
Due to the high number of field names in the Graph API existing objects, in order to facilitate your code maintainability, enum-like classes are provided.
|
||||
These files are stored under the `FacebookAds/Object/Fields` directory.
|
||||
You can access object properties in the same manner you would usually do in php:
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
|
||||
$account = new AdAccount();
|
||||
$account->name = 'My account name';
|
||||
echo $account->name;
|
||||
```
|
||||
|
||||
or using the enums:
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\AdAccountFields;
|
||||
|
||||
$account = new AdAccount();
|
||||
$account->{AdAccountFields::NAME} = 'My account name';
|
||||
echo $account->{AdAccountFields::NAME};
|
||||
```
|
||||
|
||||
### Object classes
|
||||
|
||||
Facebook Ads entities are defined as classes under the `FacebookAds/Object` directory.
|
||||
|
||||
#### Read Objects
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
|
||||
$account = (new AdAccount($account_id))->getSelf();
|
||||
```
|
||||
|
||||
For some objects, the Ads API doesn't return all available fields by default. The first argument of the object's read method is an array of field names to be requested.
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\AdAccountFields;
|
||||
|
||||
$fields = array(
|
||||
AdAccountFields::ID,
|
||||
AdAccountFields::NAME,
|
||||
);
|
||||
|
||||
$account = (new AdAccount($account_id))->getSelf($fields);
|
||||
```
|
||||
Requesting an high number of fields may cause the response time to visibly increase, you should always request only the fields you really need.
|
||||
|
||||
#### Create Objects
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdSet;
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\AdSetFields;
|
||||
|
||||
$account_id = 'act_123123';
|
||||
$campaign_id = '123456';
|
||||
|
||||
$account = new AdAccount($account_id);
|
||||
$adset = $account->createAdSet(
|
||||
array(),
|
||||
array(
|
||||
AdSetFields::NAME => 'My Test AdSet',
|
||||
AdSetFields::CAMPAIGN_ID => campaign_id,
|
||||
AdSetFields::DAILY_BUDGET => 150,
|
||||
AdSetFields::START_TIME => (new \DateTime("+1 week"))->format(\DateTime::ISO8601),
|
||||
AdSetFields::END_TIME => (new \DateTime("+2 week"))->format(\DateTime::ISO8601),
|
||||
AdSetFields::BILLING_EVENT => 'IMPRESSIONS',
|
||||
AdSetFields::TARGETING => array('geo_locations' => array('countries' => array('US'))),
|
||||
AdSetFields::BID_AMOUNT => '1000',
|
||||
)
|
||||
);
|
||||
|
||||
echo $adset->id;
|
||||
```
|
||||
|
||||
#### Update Objects
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdSet;
|
||||
use FacebookAds\Object\Fields\AdSetFields;
|
||||
|
||||
$ad_set_id = '123456';
|
||||
|
||||
$set = new AdSet($ad_set_id);
|
||||
$fields = array(
|
||||
);
|
||||
$params = array(
|
||||
AdSetFields::NAME => 'My new AdSet name',
|
||||
);
|
||||
$set->updateSelf($fields, $params);
|
||||
```
|
||||
|
||||
#### Delete Objects
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdSet;
|
||||
|
||||
$ad_set_id = '123456';
|
||||
|
||||
$set = new AdSet($ad_set_id);
|
||||
$set->deleteSelf();
|
||||
```
|
||||
|
||||
### Cursors
|
||||
|
||||
Since the release of the Facebook Graph API 2.0, pagination is handled through [cursors](https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging).
|
||||
Here cursors are defined as in `\FacebookAds\Cursor`. Cursors are generally returned from connection methods:
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AdAccount;
|
||||
use FacebookAds\Object\Fields\CampaignFields;
|
||||
|
||||
$account = new AdAccount('<ACT_ID>');
|
||||
$cursor = $account->getCampaigns(['id','name']);
|
||||
|
||||
// Loop over objects
|
||||
foreach ($cursor as $campaign) {
|
||||
echo $campaign->{CampaignFields::NAME}.PHP_EOL;
|
||||
}
|
||||
|
||||
// Access objects by index
|
||||
if ($cursor->count() > 0) {
|
||||
echo "The first campaign in the cursor is: ".$cursor[0]->{CampaignFields::NAME}.PHP_EOL;
|
||||
}
|
||||
|
||||
// Fetch the next page
|
||||
$cursor->fetchAfter();
|
||||
// New Objects will be appended to the cursor
|
||||
```
|
||||
|
||||
#### Implicit Fetching
|
||||
|
||||
Whenever all object connected to a parent are required (carelessly from the number of HTTP requests) implicit fetching can help reducing the amount of code required.
|
||||
If cursor has Implicit Fetching enabled, while iterating (foreach, Cursor::next(), Cursor::prev()) the page end is reached, the SDK will automatically fetch and append a new page, until cursor end.
|
||||
Implicit Fetching will make you lose control of the number of HTTP request that will be sent and, for this reason, is disabled by default.
|
||||
Implicit Fetching can be enabled for a specific cursor:
|
||||
|
||||
```php
|
||||
$cursor->setUseImplicitFetch(true);
|
||||
```
|
||||
|
||||
Or globally:
|
||||
|
||||
```php
|
||||
use FacebookAds\Cursor;
|
||||
|
||||
Cursor::setDefaultUseImplicitFetch(true);
|
||||
```
|
||||
|
||||
#### Reverse Iterations
|
||||
|
||||
Cursors are bi-directional, and can be iterated in reverse order:
|
||||
|
||||
```php
|
||||
use FacebookAds\Object\AbstractCrudObject;
|
||||
|
||||
/** @var \FacebookAds\Cursor $cursor */
|
||||
$cursor->setUseImplicitFetch(true);
|
||||
|
||||
$cursor->end();
|
||||
while ($cursor->valid()) {
|
||||
echo $cursor->current()->{AbstractCrudObject::FIELD_ID}.PHP_EOL;
|
||||
$cursor->prev();
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
The 'test' folder contains the test cases. These are logically divided in unit and integration tests.
|
||||
Integration tests require an active Facebook Ad Account, a Facebook Application and a valid Access Token.
|
||||
|
||||
Note: we are currently unable to securely and reliably run integration tests on a public CI system. Our integrations with Travis and Scrutinizer (including badges at the top of this file) include only unit tests.
|
||||
|
||||
|
||||
### Install dependencies
|
||||
|
||||
From the root folder run:
|
||||
|
||||
```shell
|
||||
php composer.phar install --dev
|
||||
```
|
||||
|
||||
### Execute unit tests only
|
||||
|
||||
```shell
|
||||
./vendor/bin/phpunit -c test/phpunit-travis.xml
|
||||
```
|
||||
|
||||
To run tests individually (be sure not to be pointing to an integration test file):
|
||||
|
||||
```shell
|
||||
./vendor/bin/phpunit -c test/phpunit-travis.xml path/to/class/file
|
||||
```
|
||||
|
||||
|
||||
### Execute all tests (unit + integration)
|
||||
|
||||
Setup your integration config:
|
||||
|
||||
1 - Copy the config file template.
|
||||
|
||||
```shell
|
||||
cp test/config.php.dist test/config.php
|
||||
```
|
||||
|
||||
2 - Edit `test/config.php` with your informations.
|
||||
|
||||
Execute:
|
||||
|
||||
```shell
|
||||
./vendor/bin/phpunit -c test/
|
||||
```
|
||||
|
||||
To run tests individually:
|
||||
|
||||
```shell
|
||||
./vendor/bin/phpunit -c test/ path/to/class/file
|
||||
```
|
||||
|
||||
## Debug
|
||||
|
||||
If this SDK is not working as expected, it may be either a SDK issue or API issue.
|
||||
|
||||
This can be identified by constructing a raw cURL request and seeing if the response is as expected
|
||||
|
||||
for example:
|
||||
|
||||
```php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
use FacebookAds\Api;
|
||||
use FacebookAds\Object\AdAccount;
|
||||
|
||||
Api::init($app_id, $app_secret, $access_token);
|
||||
$api = Api::instance();
|
||||
|
||||
use FacebookAds\Logger\CurlLogger;
|
||||
$api->setLogger(new CurlLogger());
|
||||
$account = new AdAccount($account_id);
|
||||
$account->read(array('id'));
|
||||
```
|
||||
|
||||
When running this code, this cURL request will be printed to the console as:
|
||||
```
|
||||
curl -G \
|
||||
-d 'fields=id' \
|
||||
-d 'access_token=<access_token>' \
|
||||
https://graph.facebook.com/v3.1/<act_accountid>
|
||||
```
|
||||
|
||||
## SDK Codegen
|
||||
Our SDK is autogenerated from [SDK Codegen](https://github.com/facebook/facebook-business-sdk-codegen). If you want to learn more about how our SDK code is generated, please check this repository.
|
||||
|
||||
## Issue
|
||||
Since we want to handle bugs more efficiently, we've decided to close issue reporting in Github and move to our dedicated bug reporting channel.
|
||||
If you encounter a bug with Business SDK (PHP), please report the issue at [our developer bug reporting channel](https://developers.facebook.com/support/bugs/).
|
||||
111
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/clean_account.php
vendored
Normal file
111
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/clean_account.php
vendored
Normal 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));
|
||||
}
|
||||
112
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/create_phar.php
vendored
Normal file
112
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/create_phar.php
vendored
Normal 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();
|
||||
68
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/docsmith.php
vendored
Normal file
68
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/docsmith.php
vendored
Normal 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());
|
||||
34
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/get_version.php
vendored
Normal file
34
modules/ps_facebook/vendor/facebook/php-business-sdk/bin/get_version.php
vendored
Normal 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;
|
||||
27
modules/ps_facebook/vendor/facebook/php-business-sdk/composer.json
vendored
Normal file
27
modules/ps_facebook/vendor/facebook/php-business-sdk/composer.json
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "facebook/php-business-sdk",
|
||||
"description": "PHP SDK for Facebook Business",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"facebook",
|
||||
"ads",
|
||||
"business",
|
||||
"sdk",
|
||||
"instagram",
|
||||
"page"
|
||||
],
|
||||
"homepage": "https://developers.facebook.com/",
|
||||
"require": {
|
||||
"prestashop/module-lib-guzzle-adapter": "^0.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~8",
|
||||
"symfony/finder": "~2.6",
|
||||
"mockery/mockery": "1.3.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"FacebookAds\\": "src/FacebookAds/"
|
||||
}
|
||||
}
|
||||
}
|
||||
45
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountActivityNode.php
vendored
Normal file
45
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountActivityNode.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use FacebookAds\Object\AdAccountActivity;
|
||||
use FacebookAds\Api;
|
||||
use FacebookAds\Logger\CurlLogger;
|
||||
|
||||
$access_token = '<ACCESS_TOKEN>';
|
||||
$app_secret = '<APP_SECRET>';
|
||||
$app_id = '<APP_ID>';
|
||||
$id = '<ACTIVITY_ID>';
|
||||
|
||||
$api = Api::init($app_id, $app_secret, $access_token);
|
||||
$api->setLogger(new CurlLogger());
|
||||
|
||||
$fields = array(
|
||||
);
|
||||
$params = array(
|
||||
);
|
||||
echo json_encode((new AdAccountActivity($id))->getSelf(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdCreativesEdge.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdCreativesEdge.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
48
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdCreativesPost.php
vendored
Normal file
48
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdCreativesPost.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 Creative',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('image_hash' => '<imageHash>','link' => 'https:\/\/facebook.com\/<pageID>','message' => 'try it out')),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 Creative',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('call_to_action' => array('type' => 'INSTALL_MOBILE_APP','value' => array('link' => '<appLink>')),'image_hash' => '<imageHash>','link' => '<appLink>','message' => 'Try it out')),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Image crop creative',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('image_crops' => array('100x100' => array(array(0,0),array(100,100))),'image_hash' => '<imageHash>','link' => '<url>','message' => 'Ad message')),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Dynamic Ad Template Creative Sample',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','template_data' => array('call_to_action' => array('type' => 'INSTALL_MOBILE_APP','value' => array('link' => 'http://www.example.com/appstoreurl')),'message' => 'Test array(array(product.name | titleize))','link' => 'http://www.example.com/appstoreurl','name' => 'Headline array(array(product.price))','description' => 'Description array(array(product.description))')),
|
||||
'product_set_id' => '<productSetID>',
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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('link_description' => 'try it out','image_url' => '<imageURL>','video_id' => '<videoID>','call_to_action' => array('type' => 'SIGN_UP','value' => array('link' => 'http:\/\/fb.me\/','lead_gen_form_id' => '<formID>')))),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 Creative',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','video_data' => array('image_url' => '<imageURL>','video_id' => '<videoID>','call_to_action' => array('type' => 'LIKE_PAGE','value' => array('page' => '<pageID>')))),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Creative',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('image_hash' => '<imageHash>','link' => 'https:\/\/facebook.com\/<pageID>','message' => 'Creative message','call_to_action' => array('type' => 'LIKE_PAGE','value' => array('page' => '<pageID>')))),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Dynamic Ad Creative with Asset Feed Spec Sample',
|
||||
'object_story_spec' => array('page_id' => '<pageID>'),
|
||||
'asset_feed_spec' => array('images' => array(array('hash' => '<imageHash>')),'bodies' => array(array('text' => 'Begin Your Adventure'),array('text' => 'Once a Trainer, always a Trainer.')),'titles' => array(array('text' => 'Level Up'),array('text' => 'Swipe to evolve')),'descriptions' => array(array('text' => 'First Dynamic Ad Creative Sample')),'ad_formats' => array('SINGLE_IMAGE'),'call_to_action_types' => array('SHOP_NOW'),'link_urls' => array(array('website_url' => 'https://www.example.com/')),'videos' => array()),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Carousel app ad',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','link_data' => array('message' => 'My message','link' => 'http://www.example.com/appstoreurl','caption' => 'WWW.ITUNES.COM','name' => 'The link name','description' => 'The link description','child_attachments' => array(array('link' => 'http://www.example.com/appstoreurl','image_hash' => '<imageHash>','call_to_action' => array('type' => 'USE_MOBILE_APP','value' => array('app_link' => '<deepLink>'))),array('link' => 'http://www.example.com/appstoreurl','image_hash' => '<imageHash>','call_to_action' => array('type' => 'USE_MOBILE_APP','value' => array('app_link' => '<deepLink>'))),array('link' => 'http://www.example.com/appstoreurl','image_hash' => '<imageHash>','call_to_action' => array('type' => 'USE_MOBILE_APP','value' => array('app_link' => '<deepLink>'))),array('link' => 'http://www.example.com/appstoreurl','image_hash' => '<imageHash>','call_to_action' => array('type' => 'USE_MOBILE_APP','value' => array('app_link' => '<deepLink>')))),'multi_share_optimized' => true)),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Dynamic Ad Template Creative Sample',
|
||||
'object_story_spec' => array('page_id' => '<pageID>','template_data' => array('message' => 'English Test array(array(product.name | titleize))','link' => 'http://www.example.com/englishurl','name' => 'English Headline array(array(product.price))','description' => 'English Description array(array(product.description))','customization_rules_spec' => array(array('customization_spec' => array('language' => 'en_XX')),array('customization_spec' => array('language' => 'fr_XX'),'message' => 'French Test array(array(product.name | titleize))','link' => 'http://www.example.com/frenchurl','name' => 'French Headline array(array(product.price))','description' => 'French Description array(array(product.description))','template_url_spec' => array('web' => array('url' => 'http://www.example.com/frenchdeeplink')))))),
|
||||
'product_set_id' => '<productSetID>',
|
||||
'template_url_spec' => array('web' => array('url' => 'http://www.example.com/englishdeeplink')),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdCreative(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
55
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPost2CreateMAIA.php
vendored
Normal file
55
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPost2CreateMAIA.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => '2022-05-30T13:26:39-0700',
|
||||
'end_time' => '2022-06-06T13:26:39-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);
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => '2022-05-30T13:27:36-0700',
|
||||
'end_time' => '2022-06-06T13:27:36-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);
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
56
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostCreateAdSet.php
vendored
Normal file
56
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostCreateAdSet.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => '2022-05-30T13:25:52-0700',
|
||||
'end_time' => '2022-06-06T13:25:52-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);
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => '2022-05-23T13:27:07-0700',
|
||||
'end_time' => '2022-05-30T13:27:07-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);
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => '2022-05-23T13:27:16-0700',
|
||||
'end_time' => '2022-06-02T13:27:16-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);
|
||||
56
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostOfferClaim.php
vendored
Normal file
56
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostOfferClaim.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 Offer Claim AdSet',
|
||||
'lifetime_budget' => '56000',
|
||||
'start_time' => '2022-05-23T13:26:58-0700',
|
||||
'end_time' => '2022-05-30T13:26:58-0700',
|
||||
'campaign_id' => '<adCampaignLinkClicksID>',
|
||||
'billing_event' => 'LINK_CLICKS',
|
||||
'optimization_goal' => 'LINK_CLICKS',
|
||||
'bid_amount' => '1000',
|
||||
'promoted_object' => array('page_id' => '<pageID>','offer_id' => '<offerID>'),
|
||||
'targeting' => array('geo_locations' => array('countries' => array('US')),'genders' => array(1),'age_min' => '25','age_max' => '55','facebook_positions' => array('feed')),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAdSet(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => '2022-05-23T13:27:25-0700',
|
||||
'end_time' => '2022-06-02T13:27:25-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);
|
||||
55
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostPageLikes.php
vendored
Normal file
55
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostPageLikes.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
55
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostReach.php
vendored
Normal file
55
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdSetsPostReach.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdVideosPost.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdVideosPost.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPixelsPost.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPixelsPost.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPost.php
vendored
Normal file
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPost.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
51
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPostAdsRedownload.php
vendored
Normal file
51
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPostAdsRedownload.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPostOfferClaim.php
vendored
Normal file
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountAdsPostOfferClaim.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 New Offers Ad',
|
||||
'adset_id' => '<adSetID>',
|
||||
'creative' => array('object_story_spec' => array('page_id' => '<pageID>','link_data' => array('offer_id' => '<offerID>','link' => 'https:\/\/www.facebook.com\/','message' => 'Great Deal','name' => '30% off','image_hash' => '<imageHash>'))),
|
||||
'status' => 'PAUSED',
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createAd(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
49
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsEdge.php
vendored
Normal file
49
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsEdge.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Conversions Campaign',
|
||||
'objective' => 'CONVERSIONS',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 Event Campaign',
|
||||
'objective' => 'EVENT_RESPONSES',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsPostLeadGen.php
vendored
Normal file
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsPostLeadGen.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'LEAD_GENERATION',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'LINK_CLICKS',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'REACH',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsPostMAIA.php
vendored
Normal file
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsPostMAIA.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'APP_INSTALLS',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsPostMAIDPA.php
vendored
Normal file
50
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCampaignsPostMAIDPA.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'APP_INSTALLS',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 Offer Claims Campaign',
|
||||
'objective' => 'OFFER_CLAIMS',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'PAGE_LIKES',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'POST_ENGAGEMENT',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'Store Traffic Campaign',
|
||||
'objective' => 'STORE_VISITS',
|
||||
'promoted_object' => array('page_id' => '<pageID>'),
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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' => 'VIDEO_VIEWS',
|
||||
'status' => 'PAUSED',
|
||||
'special_ad_categories' => array(),
|
||||
);
|
||||
echo json_encode((new AdAccount($id))->createCampaign(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCustomAudiencesEdge.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountCustomAudiencesEdge.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
48
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountGeneratePreviewsEdge.php
vendored
Normal file
48
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountGeneratePreviewsEdge.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountNode.php
vendored
Normal file
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountReachEstimate.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdAccountReachEstimate.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignActivityNode.php
vendored
Normal file
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignActivityNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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 = '<ACTIVITY_ID>';
|
||||
|
||||
$api = Api::init($app_id, $app_secret, $access_token);
|
||||
$api->setLogger(new CurlLogger());
|
||||
|
||||
$fields = array(
|
||||
'created_time',
|
||||
);
|
||||
$params = array(
|
||||
);
|
||||
echo json_encode((new AdSet($id))->getSelf(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignGroupActivityNode.php
vendored
Normal file
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignGroupActivityNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use FacebookAds\Object\Campaign;
|
||||
use FacebookAds\Api;
|
||||
use FacebookAds\Logger\CurlLogger;
|
||||
|
||||
$access_token = '<ACCESS_TOKEN>';
|
||||
$app_secret = '<APP_SECRET>';
|
||||
$app_id = '<APP_ID>';
|
||||
$id = '<ACTIVITY_ID>';
|
||||
|
||||
$api = Api::init($app_id, $app_secret, $access_token);
|
||||
$api->setLogger(new CurlLogger());
|
||||
|
||||
$fields = array(
|
||||
'time_created',
|
||||
);
|
||||
$params = array(
|
||||
);
|
||||
echo json_encode((new Campaign($id))->getSelf(
|
||||
$fields,
|
||||
$params
|
||||
)->exportAllData(), JSON_PRETTY_PRINT);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignGroupAdsEdge.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignGroupAdsEdge.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
51
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignGroupAdsetsEdge.php
vendored
Normal file
51
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignGroupAdsetsEdge.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignNode.php
vendored
Normal file
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignPost.php
vendored
Normal file
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignPost.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
49
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignPostAdsetUpdateCpa.php
vendored
Normal file
49
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCampaignPostAdsetUpdateCpa.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativeCreativeInsightsEdge.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativeCreativeInsightsEdge.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use FacebookAds\Object\AdCreative;
|
||||
use FacebookAds\Object\AdCreativeInsights;
|
||||
use FacebookAds\Api;
|
||||
use FacebookAds\Logger\CurlLogger;
|
||||
|
||||
$access_token = '<ACCESS_TOKEN>';
|
||||
$app_secret = '<APP_SECRET>';
|
||||
$app_id = '<APP_ID>';
|
||||
$id = '<CREATIVE_ID>';
|
||||
|
||||
$api = Api::init($app_id, $app_secret, $access_token);
|
||||
$api->setLogger(new CurlLogger());
|
||||
|
||||
$fields = array(
|
||||
'creative_compass_scores',
|
||||
);
|
||||
$params = array(
|
||||
);
|
||||
echo json_encode((new AdCreative($id))->getCreativeInsights(
|
||||
$fields,
|
||||
$params
|
||||
)->getResponse()->getContent(), JSON_PRETTY_PRINT);
|
||||
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativeNode.php
vendored
Normal file
46
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativeNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativeNodeRead.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativeNodeRead.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
48
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativePreviewsEdge.php
vendored
Normal file
48
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativePreviewsEdge.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativePreviewsEdgePreview.php
vendored
Normal file
47
modules/ps_facebook/vendor/facebook/php-business-sdk/examples/AdCreativePreviewsEdgePreview.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-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.
|
||||
*/
|
||||
|
||||
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);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user