facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
818 stars 514 forks source link

Error - You have not selected Placements #473

Closed Stacey940 closed 5 years ago

Stacey940 commented 5 years ago

Hi , I am trying to place ads , everything seems to be working , but when I login into my business manager account it says "you have not selected placement" and to add placement in the section.

I have gone through the examples on the docs , but it doesn't show how and where to add the placement Here is the code:

try{
$adset = new AdSet(null, '<ad account >');

  $adset->setData(array(
    AdSetFields::NAME => 'Some Name',
    AdSetFields::BID_AMOUNT => 2,
    AdSetFields::BILLING_EVENT => BillingEvents::IMPRESSIONS,
    AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::LEAD_GENERATION,
    AdSetFields::DAILY_BUDGET => 300,
    AdSetFields::CAMPAIGN_ID => 'campaign id',
    AdSetFields::PROMOTED_OBJECT => array('page_id' => '<my page id>'),
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::PUBLISHER_PLATFORMS => array(
                  'facebook',
                  'audience_network',
                ),
    TargetingFields::GEO_LOCATIONS => array(
      'custom_locations' => array(
        array(
          'address_string' => 'my address to traget',
          'radius' => '25',
          'distance_unit' => 'mile',
        )
          ),
       'location_types' => array('recent', 'home'),

    ),

    TargetingFields::AGE_MIN => 21,
    TargetingFields::AGE_MAX => 55,
    )),

  ));

 $adset->create();
\Log::info($adset->id);
}
catch (Exception $e) {
//handle exception
}
Stacey940 commented 5 years ago

Every time I place an ads I have login to my business manager account and Select "Automatic" under the placement section.

jingping2015 commented 5 years ago

Hey, thanks for your comment! This is actually an api issue. Please report the issue on Devsite Bug Report channel: https://developers.facebook.com/support/bugs/ Thanks!

Stacey940 commented 5 years ago

@jingping2015 Hi, I reported the bug and they said that this is not a issue with the platform.