public function setup()
 {
     parent::setup();
     $this->productCatalog = new ProductCatalog(null, $this->getConfig()->businessId);
     $this->productCatalog->setData(array(ProductCatalogFields::NAME => $this->getConfig()->testRunId));
     $this->productCatalog->create();
 }
 public function setup()
 {
     parent::setup();
     $this->productCatalog = new ProductCatalog(null, $this->getBusinessManagerId());
     $this->productCatalog->setData(array(ProductCatalogFields::NAME => $this->getTestRunId()));
     $this->productCatalog->create();
 }
 public function setup()
 {
     parent::setup();
     $this->account = new AdAccount($this->getActId());
     $cursor = $this->account->getAdsPixels();
     $this->adsPixel = $cursor->current();
     $this->productCatalog = new ProductCatalog(null, $this->getBusinessManagerId());
     $this->productCatalog->setData(array(ProductCatalogFields::NAME => 'Test Catalog ' . $this->getTestRunId()));
     $this->productCatalog->create();
     $this->productSet = new ProductSet(null, $this->productCatalog->{ProductCatalogFields::ID});
     $this->productSet->setData(array(ProductSetFields::NAME => 'Test Set ' . $this->getTestRunId(), ProductSetFields::FILTER => array('retailer_id' => array('is_any' => array('pid1', 'pid2')))));
     $this->productSet->create();
 }
 public function setup()
 {
     parent::setup();
     $this->account = new AdAccount($this->getConfig()->accountId);
     $cursor = $this->account->getAdsPixels();
     $this->adsPixel = $cursor->current();
     $this->productCatalog = new ProductCatalog(null, $this->getConfig()->businessId);
     $this->productCatalog->setData(array(ProductCatalogFields::NAME => $this->getConfig()->testRunId));
     $this->productCatalog->create();
     $this->productSet = new ProductSet(null, $this->productCatalog->{ProductCatalogFields::ID});
     $this->productSet->setData(array(ProductSetFields::NAME => $this->getConfig()->testRunId, ProductSetFields::FILTER => array('retailer_id' => array('is_any' => array('pid1', 'pid2')))));
     $this->productSet->create();
 }
 public function setup()
 {
     parent::setup();
     $account = new AdAccount($this->getConfig()->accountId);
     $this->adsPixel = $account->getAdsPixels()->current();
     if ($this->adsPixel === null) {
         throw new \Exception('Ads Pixel is null');
     }
     $this->productCatalog = new ProductCatalog(null, $this->getConfig()->businessId);
     $this->productCatalog->setData(array(ProductCatalogFields::NAME => $this->getConfig()->testRunId));
     $this->productCatalog->create();
     $this->productSet = new ProductSet(null, $this->productCatalog->{ProductCatalogFields::ID});
     $this->productSet->setData(array(ProductSetFields::NAME => $this->getConfig()->testRunId, ProductSetFields::FILTER => array('retailer_id' => array('is_any' => array('pid1', 'pid2')))));
     $this->productSet->create();
     $this->productAudience = new ProductAudience(null, $this->getConfig()->accountId);
     $this->productAudience->setData(array(ProductAudienceFields::NAME => $this->getConfig()->testRunId, ProductAudienceFields::PRODUCT_SET_ID => $this->productSet->{ProductSetFields::ID}, ProductAudienceFields::PIXEL_ID => $this->adsPixel->{AdsPixelsFields::ID}, ProductAudienceFields::INCLUSIONS => array(array('retention_seconds' => 86400, 'rule' => array('and' => array(array('event' => array('eq' => 'ViewContent')), array('userAgent' => array('i_contains' => 'iPhone'))))))));
     $this->productAudience->create();
 }
// use FacebookAds\Object\Values\AdObjectives;
$campaign = new AdCampaign(null, $ad_account_id);
$campaign->setData(array(AdCampaignFields::NAME => 'Video Views Campaign', AdCampaignFields::OBJECTIVE => AdObjectives::VIDEO_VIEWS, AdCampaignFields::STATUS => AdCampaign::STATUS_PAUSED));
$campaign->create();
// _DOC close [ADCAMPAIGN_CREATE_VIDEO_VIEWS]
$campaign->delete();
// _DOC open [ADCAMPAIGN_CREATE_LOCAL_AWARENESS]
// _DOC vars [ad_account_id:s]
// use FacebookAds\Object\AdCampaign;
// use FacebookAds\Object\AdCampaignFields;
// use FacebookAds\Object\Values\AdObjectives;
$campaign = new AdCampaign(null, $ad_account_id);
$campaign->setData(array(AdCampaignFields::NAME => 'Local awareness campaign', AdCampaignFields::OBJECTIVE => AdObjectives::LOCAL_AWARENESS, AdCampaignFields::STATUS => AdCampaign::STATUS_PAUSED));
$campaign->create();
// _DOC close [ADCAMPAIGN_CREATE_LOCAL_AWARENESS]
$campaign->delete();
$product_catalog = new ProductCatalog(null, $business_id);
$product_catalog->setData(array(ProductCatalogFields::NAME => 'Test Catalog'));
$product_catalog->create();
$product_catalog_id = $product_catalog->{ProductCatalogFields::ID};
// _DOC open [ADCAMPAIGN_CREATE_OBJECTIVE_PRODUCT_CATELOG_SALES]
// _DOC vars [ad_account_id:s, product_catalog_id]
// use FacebookAds\Object\AdCampaign;
// use FacebookAds\Object\Fields\AdCampaignFields;
// use FacebookAds\Object\Values\AdObjectives;
$campaign = new AdCampaign(null, $ad_account_id);
$campaign->setData(array(AdCampaignFields::NAME => 'Product Catalog Sales Campaign Group', AdCampaignFields::OBJECTIVE => AdObjectives::PRODUCT_CATALOG_SALES, AdCampaignFields::STATUS => AdCampaign::STATUS_PAUSED, AdCampaignFields::PROMOTED_OBJECT => array('product_catalog_id' => $product_catalog_id)));
$campaign->create();
// _DOC close [ADCAMPAIGN_CREATE_OBJECTIVE_PRODUCT_CATELOG_SALES]
$campaign->delete();
$product_catalog->delete();