Grundlegendes Targeting

Das grundlegende oder „Core Targeting“ umfasst folgende Kriterien:

Einschränkungen

Werbetreibende, die sich in den USA befinden oder für die USA targetierte Werbeanzeigen für Wohnraum, Jobangebote, Kredite, gesellschaftlich relevante Themen, Wahlen, oder Politik schalten, unterliegen anderen Einschränkungen.

Demografische Angaben und Events

Beginne mit dem Targeting auf der Grundlage von einfachen demografischen Angaben und Standorten. Normalerweise erhältst du die Daten zum Definieren des Targetings aus der Targeting-Suche. Anschließend kannst du unter „Targeting-Spezifikationen“ Optionen festlegen. Targeting-Spezifikationen sind Merkmale von Anzeigengruppen, die festlegen, wer eine Anzeige sieht.

Du musst beim Targeting mindestens ein Land festlegen, es sei denn, du verwendest Custom Audiences.

Targeting nach Demografie:

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My AdSet',
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::BID_AMOUNT => 2,
  AdSetFields::DAILY_BUDGET => 1000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array(
        'US',
      ),
    ),
    TargetingFields::RELATIONSHIP_STATUSES => array(2, 4),
    TargetingFields::LIFE_EVENTS => array(
      array(
        'id' => 6003054185372,
        'name' => 'Recently Moved',
      ),
    ),
    TargetingFields::INDUSTRIES => array(
      array(
        'id' => 6009003307783,
        'name' => 'Accounting and finance',
      ),
    ),
  )),
));
$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_ACTIVE,
));
from facebookads.adobjects.adset import AdSet

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.targeting: {
        'geo_locations': {
            'countries': ['US'],
        },
        'relationship_statuses': [2, 4],
        'life_events': [
            {
                'id': 6003054185372,
                'name': 'Recently Moved',
            },
        ],
        'industries': [
            {
                'id': 6009003307783,
                'name': 'Accounting and finance',
            },
        ],
    },
})
adset.remote_create(params={
    'status': AdSet.Status.active,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My AdSet")
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setBidAmount(2L)
  .setDailyBudget(1000L)
  .setCampaignId(<CAMPAIGN_ID>)
  .setTargeting(
    new Targeting()
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCountries(Arrays.asList("US"))
      )
      .setFieldIndustries(Arrays.asList(
        new IDName()
          .setFieldId("6009003307783")
          .setFieldName("Accounting and finance")
      ))
      .setFieldLifeEvents(Arrays.asList(
        new IDName()
          .setFieldId("6003054185372")
          .setFieldName("Recently Moved")
      ))
      .setFieldRelationshipStatuses(Arrays.asList(2L, 4L))
  )
  .setStatus(AdSet.EnumStatus.VALUE_ACTIVE)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My AdSet' \
  -F 'optimization_goal=REACH' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'bid_amount=2' \
  -F 'daily_budget=1000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={ 
    "geo_locations": {"countries":["US"]}, 
    "industries": [{"id":6009003307783,"name":"Accounting and finance"}], 
    "life_events": [{"id":6003054185372,"name":"Recently Moved"}], 
    "relationship_statuses": [2,4] 
  }' \
  -F 'status=ACTIVE' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Verfügbare Felder

NameBeschreibung

genders

array

Geschlecht für das Targeting. Standardmäßig alle Geschlechter. 1 richtet sich an Männer, 2 richtet sich an Frauen.

age_min

int

Mindestalter. Steht standardmäßig auf 18. Muss, falls verwendet, auf 13 oder höher festgelegt werden. Falls die App benutzerdefinierte Einstellungen für Alterseinschränkungen hat, werden die Alterseinschränkungen für Werbeanzeigen mit dem Ziel APP_INSTALL verwendet. Beispielsweise wird im Anzeigen-Targeting 18 verwendet, wenn du für age_min 13 einstellst, aber das Mindestalter deiner App auf 18 eingestellt ist.

age_max

int

Höchstalter. Muss, falls verwendet, auf 65 oder niedriger festgelegt werden.

Standort

Suche über die Targeting Search API nach Werten für das Standort-Targeting und rufe diese ab. Bei diesem Targeting gibt es zwei Parameter: geo_locations zum Abzielen auf Standorte und optional excluded_geo_locations zum Ausschließen von bestimmten Gebieten.

Verwende country_groups für geo_locations zum Abzielen auf größere geografische Regionen wie Europa oder Nordamerika.

Using radius can cause an error, code: 100, subcode 1815946, when targeting multiple locations. We recommend creating an ad for each location or not using radius in your call.

Verfügbare Felder

NameBeschreibung

countries

array

Länder-Targeting. Erfordert ein Array von Ländercodes. Targeting-Suche, Länder. Beispiel: 'countries': ['US']

regions

array

Bundesstaat, Provinz oder Region. Die verfügbaren Werte findest du unter Targeting-Suche, Regionen. Höchstwert: 200.
Beispiel: 'regions': [{'key':'3847'}]

cities

Array

Lege key, radius und distance_unit fest. Informationen zu key findest du unter Targeting-Suche, Städte. radius stellt die Entfernung zu den Städten dar und reicht von 10 bis 50 Meilen bzw. 17 bis 80 Kilometern. distance_unit ist entweder Meile oder Kilometer. Höchstwert: 250.
Beispiel: 'cities': [{'key':'2430536', 'radius':12, 'distance_unit':'mile'}]

zips

Array

Zielpostleitzahl, siehe Targeting Search API. Höchstwert: 50.000. Früher 2.500. Wenn du mehr als 2.500 festlegst, erstellen wir das Array location_cluster, das für einen Satz Postleitzahlen steht. Beispiel: 'zips':[{'key':'US:94304'},{'key':'US:00501'}]

So liest du einen location_cluster und zeigst die Zielstandorte an: GET /location_cluster_ID

places

Array

Gib ein einen bestimmten Standort an. Höchstwert: 200. Beispiel:"places":[{"key":129672430416115,"name":"SFO", "radius":10, "distance_unit":"mile"}]

custom_locations

Array

Ist für alle Ziele verfügbar. Gibt den genauen Standort mit Längen- und Breitengrad oder die Anschrift als Zentrum eines Bereichs an. Bestimmt außerdem den Radius für deinen Standort im Bereich von 0,63 bis 50 Meilen bzw. 1 bis 80 Kilometern. distance_unit ist entweder Meile oder Kilometer, der Standardwert ist Meile. Höchstwert: 200. Eine Angabe, die nur ein Postfach enthält, wird von address_string nicht unterstützt. Du musst mindestens eine Anschrift angeben. Beispiel:'custom_locations':[{'address_string': '1601 Willow Road, Menlo Park, CA', 'radius': 5},{'latitude': 36, 'longitude': -121.0, 'radius': 5, 'distance_unit': 'kilometer'},]

custom_locations.latitude

Float

Breitengrad des Standorts

custom_locations.longitude

Float

Längengrad des Standorts

custom_locations.name

string

Name der Anschrift. Du kannst beim Geolocation-Targeting Werte für latitude und longitude verwenden und musst keinen address_string angeben.

custom_locations.radius

Float

Radius um Längengrad/Breitengrad, in Meilen, sofern über distance_unit nicht anders festgelegt. Von 0,63 bis 50 Meilen oder 1 bis 80 Kilometer.

custom_locations.distance_unit

string

Optional.

kilometer oder mile; Standardwert: mile

custom_locations.address_string

string

Anschrift am Längengrad/Breitengrad, zum Beispiel „1601 Willow Rd, Menlo Park, CA“. Empfohlenes Format: Hausnummer, Straßenname, Stadt, Bundesstaat/Provinz, Land. Schließe die Postleitzahl aus.

geo_markets

Array

Schlüssel für Markt, im Format „DMA:501“. Wir unterstützen alle designierten Marktgebiete (DMAs, Designated Market Areas). Du findest die DMA-Codes über die Targeting-Suche, indem du die DMA-Namen abfragst. Höchstwert: 2.500
Beispiel:'geo_markets':[{'key': 'DMA:501', 'name': 'New York'},{'key': 'DMA:543', 'name': 'Springfield-Holyoke'},]

electoral_district

Array

Schlüssel für Wahlbezirke. Du findest die Bezirke unter Targeting-Suche, Wahlbezirke.
Beispiel: 'electoral_districts':[{'key':'US:AK00'},{'key':'US:CA01'},{'key':'US:NY14'}]

location_types

Array

Hinweis: Ab Version 18.0 wird der Array ['home', 'recent'] die einzige verfügbare Option sein.


Wenn in Version 18.0 und höher kein location_types bereitgestellt wird, wird standardmäßig der Array ['home', 'recent'] verwendet.


  • recent: Personen, deren aktueller Standort nach Angaben von Daten auf Mobilgeräten im ausgewählten Gebiet liegt. Dieser Typ steht für den Ausschluss von Standorten nicht zur Verfügung.
  • home: Personen, deren im Facebook-Profil als „aktueller Wohnort“ angegebener Standort im ausgewählten Gebiet liegt. Facebook überprüft dies anhand der IP-Adresse und Informationen zu Profilstandorten von Freund*innen.

country_groups

Array

Weltregionen und Freihandelszonen. Stelle ein Array von Ländergruppencodes bereit:


worldwide: weltweit

africa: Afrika

afta: ASEAN-Freihandelszone

android_app_store: kostenpflichtige Apps im Android-App-Store, die Länder unterstützen

android_free_store: kostenlose Apps im Android-App-Store, die Länder unterstützen

apec: Asiatisch-Pazifische Wirtschaftsgemeinschaft

asia: Asien

caribbean: Karibik

central_america: Zentralamerika

cisfta: Commonwealth of Independent States Free Trade Area

eea: Europäischer Wirtschaftsraum

emerging_markets: Schwellenländer

europe: Europa

gcc: Golf-Kooperationsrat

itunes_app_store: vom iTunes-App Store unterstützte Länder

mercosur: MERCOSUR

nafta: NAFTA

north_america: Nordamerika

oceania: Ozeanien

south_america: Südamerika


Siehe Targeting-Suche, Ländergruppen.

Beispiel: 'country_groups': ['asia','mercosur']

Beispiele

Targeting nach Ländern

curl -X POST \ -F 'name="My Reach Ad Set"' \ -F 'optimization_goal="REACH"' \ -F 'billing_event="IMPRESSIONS"' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'targeting={ "geo_locations": { "countries": [ "US" ] }, "facebook_positions": [ "feed" ] }' \ -F 'status="PAUSED"' \ -F 'promoted_object={ "page_id": "<PAGE_ID>" }' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v20.0/act_<AD_ACCOUNT_ID>/adsets
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdSet = bizSdk.AdSet; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My Reach Ad Set', 'optimization_goal' : 'REACH', 'billing_event' : 'IMPRESSIONS', 'bid_amount' : '2', 'daily_budget' : '1000', 'campaign_id' : '<adCampaignLinkClicksID>', 'targeting' : {'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, 'status' : 'PAUSED', 'promoted_object' : {'page_id':'<pageID>'}, }; const adsets = (new AdAccount(id)).createAdSet( fields, params ); logApiCallResult('adsets api call complete.', adsets);
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);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adset import AdSet from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My Reach Ad Set', 'optimization_goal': 'REACH', 'billing_event': 'IMPRESSIONS', 'bid_amount': '2', 'daily_budget': '1000', 'campaign_id': '<adCampaignLinkClicksID>', 'targeting': {'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, 'status': 'PAUSED', 'promoted_object': {'page_id':'<pageID>'}, } print AdAccount(id).create_ad_set( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdSet() .setName(\"My Reach Ad Set\") .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) .setBidAmount(2L) .setDailyBudget(1000L) .setCampaignId(\"<adCampaignLinkClicksID>\") .setTargeting( new Targeting() .setFieldFacebookPositions(Arrays.asList(\"feed\")) .setFieldGeoLocations( new TargetingGeoLocation() .setFieldCountries(Arrays.asList(\"US\")) ) ) .setStatus(AdSet.EnumStatus.VALUE_PAUSED) .setPromotedObject(\"{\\"page_id\\":\\"<pageID>\\"}\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adsets = ad_account.adsets.create({ name: 'My Reach Ad Set', optimization_goal: 'REACH', billing_event: 'IMPRESSIONS', bid_amount: '2', daily_budget: '1000', campaign_id: '<adCampaignLinkClicksID>', targeting: {'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, status: 'PAUSED', promoted_object: {'page_id':'<pageID>'}, })

Standort-Targeting mit Ausschlüssen

curl -X POST \ -F 'name="My Reach Ad Set"' \ -F 'optimization_goal="REACH"' \ -F 'billing_event="IMPRESSIONS"' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'targeting={ "excluded_geo_locations": { "regions": [ { "key": "3847" } ] }, "geo_locations": { "countries": [ "US" ] }, "facebook_positions": [ "feed" ] }' \ -F 'status="PAUSED"' \ -F 'promoted_object={ "page_id": "<PAGE_ID>" }' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v20.0/act_<AD_ACCOUNT_ID>/adsets
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdSet = bizSdk.AdSet; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My Reach Ad Set', 'optimization_goal' : 'REACH', 'billing_event' : 'IMPRESSIONS', 'bid_amount' : '2', 'daily_budget' : '1000', 'campaign_id' : '<adCampaignLinkClicksID>', 'targeting' : {'excluded_geo_locations':{'regions':[{'key':'3847'}]},'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, 'status' : 'PAUSED', 'promoted_object' : {'page_id':'<pageID>'}, }; const adsets = (new AdAccount(id)).createAdSet( fields, params ); logApiCallResult('adsets api call complete.', adsets);
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);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adset import AdSet from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My Reach Ad Set', 'optimization_goal': 'REACH', 'billing_event': 'IMPRESSIONS', 'bid_amount': '2', 'daily_budget': '1000', 'campaign_id': '<adCampaignLinkClicksID>', 'targeting': {'excluded_geo_locations':{'regions':[{'key':'3847'}]},'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, 'status': 'PAUSED', 'promoted_object': {'page_id':'<pageID>'}, } print AdAccount(id).create_ad_set( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdSet() .setName(\"My Reach Ad Set\") .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) .setBidAmount(2L) .setDailyBudget(1000L) .setCampaignId(\"<adCampaignLinkClicksID>\") .setTargeting( new Targeting() .setFieldExcludedGeoLocations( new TargetingGeoLocation() .setFieldRegions(Arrays.asList( new TargetingGeoLocationRegion() .setFieldKey(\"3847\") )) ) .setFieldFacebookPositions(Arrays.asList(\"feed\")) .setFieldGeoLocations( new TargetingGeoLocation() .setFieldCountries(Arrays.asList(\"US\")) ) ) .setStatus(AdSet.EnumStatus.VALUE_PAUSED) .setPromotedObject(\"{\\"page_id\\":\\"<pageID>\\"}\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adsets = ad_account.adsets.create({ name: 'My Reach Ad Set', optimization_goal: 'REACH', billing_event: 'IMPRESSIONS', bid_amount: '2', daily_budget: '1000', campaign_id: '<adCampaignLinkClicksID>', targeting: {'excluded_geo_locations':{'regions':[{'key':'3847'}]},'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, status: 'PAUSED', promoted_object: {'page_id':'<pageID>'}, })

Targeting nach Postleitzahlen

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My AdSet',
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::BID_AMOUNT => 2,
  AdSetFields::DAILY_BUDGET => 1000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      TargetingFields::ZIPS => array(
        array(
          'key' => 'US:94304',
        ),
        array(
          'key' => 'US:00501',
        ),
      ),
    ),
  )),
));
$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_ACTIVE,
));
from facebookads.adobjects.adset import AdSet

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.targeting: {
        'geo_locations': {
            'zips': [
                {
                    'key': 'US:94304',
                },
                {
                    'key': 'US:00501',
                },
            ],
        },
    },
})
adset.remote_create(params={
    'status': AdSet.Status.active,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My AdSet")
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setBidAmount(2L)
  .setDailyBudget(1000L)
  .setCampaignId(<CAMPAIGN_ID>)
  .setTargeting(
    new Targeting()
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldZips(Arrays.asList(
            new TargetingGeoLocationZip()
              .setFieldKey("US:94304")
          , 
            new TargetingGeoLocationZip()
              .setFieldKey("US:00501")
          ))
      )
  )
  .setStatus(AdSet.EnumStatus.VALUE_ACTIVE)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My AdSet' \
  -F 'optimization_goal=REACH' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'bid_amount=2' \
  -F 'daily_budget=1000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={"geo_locations":{"zips":[{"key":"US:94304"},{"key":"US:00501"}]}}' \
  -F 'status=ACTIVE' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Targeting nach personalisierten Standorten, DMAs und Standorttypen

Mit dem folgenden Code wird Targeting für Folgendes eingerichtet:

  • 5 Meilen im Umkreis um 1601 Willow Road, Menlo Park, CA
  • 5 Kilometer im Umkreis von Breitengrad 36, Längengrad 121,0
  • DMAs 501 und 543 mit dem Standorttyp „recent“ und „home“
use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My AdSet',
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::BID_AMOUNT => 2,
  AdSetFields::DAILY_BUDGET => 1000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'custom_locations' => array(
        array(
          'address_string' => '1601 Willow Road, Menlo Park, CA',
          'radius' => '5',
        ),
        array(
          'latitude' => '36',
          'longitude' => '-121.0',
          'radius' => '5',
          'distance_unit' => 'kilometer',
        ),
      ),
      'geo_markets' => array(
        array(
          'key' => 'DMA:501',
          'name' => 'New York',
        ),
        array(
          'key' => 'DMA:543',
          'name' => 'Springfield-Holyoke',
        ),
      ),
      'location_types' => array('recent', 'home'),
    ),
  )),
));
$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_ACTIVE,
));
from facebookads.adobjects.adset import AdSet

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.targeting: {
        'geo_locations': {
            'custom_locations': [
                {
                    'custom_type': 'multi_city',
                    'min_population': 500000,
                    'max_population': 1000000,
                    'country': 'BR',
                },
                {
                    'custom_type': 'multi_city',
                    'country_group': 'Europe',
                },
            ],
            'location_types': ['recent', 'home'],
        },
    },
})
adset.remote_create(params={
    'status': AdSet.Status.active,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My AdSet")
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setBidAmount(2L)
  .setDailyBudget(1000L)
  .setCampaignId(<CAMPAIGN_ID>)
  .setTargeting(
    new Targeting()
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCustomLocations(Arrays.asList(
            new TargetingGeoLocationCustomLocation()
              .setFieldAddressString("1601 Willow Road, Menlo Park, CA")
              .setFieldRadius((double) 5)
          , 
            new TargetingGeoLocationCustomLocation()
              .setFieldDistanceUnit("kilometer")
              .setFieldLatitude((double) 36)
              .setFieldLongitude((double) -121.0)
              .setFieldRadius((double) 5)
          ))
          .setFieldGeoMarkets(Arrays.asList(
            new TargetingGeoLocationMarket()
              .setFieldKey("DMA:501")
              .setFieldName("New York")
          , 
            new TargetingGeoLocationMarket()
              .setFieldKey("DMA:543")
              .setFieldName("Springfield-Holyoke")
          ))
          .setFieldLocationTypes(Arrays.asList("recent", "home"))
      )
  )
  .setStatus(AdSet.EnumStatus.VALUE_ACTIVE)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My AdSet' \
  -F 'optimization_goal=REACH' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'bid_amount=2' \
  -F 'daily_budget=1000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={ 
    "geo_locations": { 
      "custom_locations": [ 
        {"address_string":"1601 Willow Road, Menlo Park, CA","radius":"5"}, 
        { 
          "latitude": "36", 
          "longitude": "-121.0", 
          "radius": "5", 
          "distance_unit": "kilometer" 
        } 
      ], 
      "geo_markets": [ 
        {"key":"DMA:501","name":"New York"}, 
        {"key":"DMA:543","name":"Springfield-Holyoke"} 
      ], 
      "location_types": ["recent","home"] 
    } 
  }' \
  -F 'status=ACTIVE' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Suche und Targeting

So richtest du dich an Männer im Alter von 20 bis 24 Jahren im Umkreis von 10 Meilen um Menlo Park, CA, oder in Texas oder Japan:

Schritt 1

Rufe zuerst den Ländercode für Japan ab:

use FacebookAds\Object\TargetingSearch;
use FacebookAds\Object\Search\TargetingSearchTypes;

$result = TargetingSearch::search(
  TargetingSearchTypes::GEOLOCATION,
  null,
  'japan',
  array(
    'location_types' => array('country'),
  ));
from facebookads.adobjects.targetingsearch import TargetingSearch
params = {
    'q': 'japan',
    'type': 'adgeolocation',
    'location_types': ['country'],
}

resp = TargetingSearch.search(params=params)
print(resp)
curl -G \
  -d 'location_types=["country"]' \
  -d 'type=adgeolocation' \
  -d 'q=japan' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/search
Schritt 2

Anschließend den Regionscode für Texas:

use FacebookAds\Object\TargetingSearch;
use FacebookAds\Object\Search\TargetingSearchTypes;

$result = TargetingSearch::search(
  TargetingSearchTypes::GEOLOCATION,
  null,
  'texas',
  array(
    'location_types' => array('region'),
  ));
from facebookads.adobjects.targetingsearch import TargetingSearch
params = {
    'q': 'texas',
    'type': 'adgeolocation',
    'location_types': ['region'],
}

resp = TargetingSearch.search(params=params)
print(resp)
curl -G \
  -d 'location_types=["region"]' \
  -d 'type=adgeolocation' \
  -d 'q=texas' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/search
Schritt 3

Suche nach dem Stadtcode für Menlo Park, CA:

use FacebookAds\Object\TargetingSearch;
use FacebookAds\Object\Search\TargetingSearchTypes;

$result = TargetingSearch::search(
  TargetingSearchTypes::GEOLOCATION,
  null,
  'menlo',
  array(
    'location_types' => array('city'),
  ));
from facebookads.adobjects.targetingsearch import TargetingSearch
params = {
    'q': 'menlo',
    'type': 'adgeolocation',
    'location_types': ['city'],
}

resp = TargetingSearch.search(params=params)
print(resp)
curl -G \
  -d 'location_types=["city"]' \
  -d 'type=adgeolocation' \
  -d 'q=menlo' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/search
Schritt 4

Lege genders und das Alter als age_min und age_max fest.

Schritt 5

So sehen unsere Targeting-Spezifikationen mit Land-, Regions- und Stadtcode aus:

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Values\AdSetBillingEventValues;


$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My First AdSet',
  AdSetFields::DAILY_BUDGET => 10000,
  AdSetFields::BID_AMOUNT => 300,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::PROMOTED_OBJECT => array(
    'page_id' => <PAGE_ID>,
  ),
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array('JP'),
      'regions' => array(array('key' => '3886')),
      'cities' => array(
        array(
          'key' => '2420605',
          'radius' => 10,
          'distance_unit' => 'mile',
        ),
      ),
    ),
    TargetingFields::GENDERS => array(1),
    TargetingFields::AGE_MIN => 20,
    TargetingFields::AGE_MAX => 24,
    TargetingFields::PUBLISHER_PLATFORMS => array(
      'facebook',
      'audience_network',
    ),
    TargetingFields::DEVICE_PLATFORMS => array('mobile'),
  )),
));


$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED,
));
from facebookads.adobjects.adset import AdSet
from facebookads.adobjects.targeting import Targeting

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.promoted_object: {'page_id': <PAGE_ID>},
    AdSet.Field.targeting: {
        Targeting.Field.geo_locations: {
            'countries': ['JP'],
            'regions': [
                {'key': '3886'},
            ],
            'cities': [
                {
                    'key': '2420605',
                    'radius': '10',
                    'distance_unit': 'mile',
                },
            ],
        },
        Targeting.Field.genders: [1],
        Targeting.Field.age_min: 20,
        Targeting.Field.age_max: 24,
        Targeting.Field.publisher_platforms: ['facebook', 'audience_network'],
        Targeting.Field.device_platforms: ['mobile'],
    },
})
adset.remote_create(params={
    'status': AdSet.Status.active,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My First AdSet")
  .setDailyBudget(10000L)
  .setBidAmount(300L)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setCampaignId(<CAMPAIGN_ID>)
  .setPromotedObject("{\"page_id\":\"" + <PAGE_ID> + "\"}")
  .setTargeting(
    new Targeting()
      .setFieldAgeMax(24L)
      .setFieldAgeMin(20L)
      .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE))
      .setFieldGenders(Arrays.asList(1L))
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCities(Arrays.asList(
            new TargetingGeoLocationCity()
              .setFieldDistanceUnit("mile")
              .setFieldKey("2420605")
              .setFieldRadius(10L)
          ))
          .setFieldCountries(Arrays.asList("JP"))
          .setFieldRegions(Arrays.asList(
            new TargetingGeoLocationRegion()
              .setFieldKey("3886")
          ))
      )
      .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network"))
  )
  .setStatus(AdSet.EnumStatus.VALUE_PAUSED)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My First AdSet' \
  -F 'daily_budget=10000' \
  -F 'bid_amount=300' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'optimization_goal=REACH' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'promoted_object={"page_id":"<PAGE_ID>"}' \
  -F 'targeting={ 
    "age_max": 24, 
    "age_min": 20, 
    "device_platforms": ["mobile"], 
    "genders": [1], 
    "geo_locations": { 
      "countries": ["JP"], 
      "regions": [{"key":"3886"}], 
      "cities": [ 
        { 
          "key": "2420605", 
          "radius": 10, 
          "distance_unit": "mile" 
        } 
      ] 
    }, 
    "publisher_platforms": ["facebook","audience_network"] 
  }' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Targeting mit mehreren Städten

Lege custom_type auf 'multi_city' fest und definiere entweder country oder country_group wie zuvor beschrieben. Dir stehen folgende zusätzliche, optionale Parameter zur Verfügung:

Name Beschreibung

min_population

int

Der Mindestbevölkerungswert, ab dem Städte für das Targeting ausgewählt werden.

max_population

int

Der Höchstbevölkerungswert, bis zu dem Städte für das Targeting ausgewählt werden.

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;

$adset = new AdSet();
$adset->setParentId('act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My AdSet',
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::BID_AMOUNT => 2,
  AdSetFields::DAILY_BUDGET => 1000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'custom_locations' => array(
        array(
          'custom_type' => 'multi_city',
          'min_population' => 500000,
          'max_population' => 1000000,
          'country' => 'BR',
        ),
        array(
          'custom_type' => 'multi_city',
          'country_group' => 'Europe',
        ),
      ),
      'location_types' => array('recent', 'home'),
    ),
  )),
));
$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_ACTIVE,
));
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adset import AdSet

ad_account = AdAccount(fbid='act_<AD_ACCOUNT_ID>')

params = {
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.targeting: {
        'geo_locations': {
            'custom_locations': [
                {
                    'custom_type': 'multi_city',
                    'min_population': 500000,
                    'max_population': 1000000,
                    'country': 'BR',
                },
                {
                    'custom_type': 'multi_city',
                    'country_group': 'Europe',
                },
            ],
            'location_types': ['recent', 'home'],
        },
    },
    AdSet.Field.status: AdSet.Status.active,
}
adset = ad_account.create_ad_set(params=params)
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My First AdSet")
  .setDailyBudget(10000L)
  .setBidAmount(300L)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setCampaignId(<CAMPAIGN_ID>)
  .setPromotedObject("{\"page_id\":\"" + <PAGE_ID> + "\"}")
  .setTargeting(
    new Targeting()
      .setFieldAgeMax(24L)
      .setFieldAgeMin(20L)
      .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE))
      .setFieldGenders(Arrays.asList(1L))
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCustomLocations(Arrays.asList(
            new TargetingGeoLocationCustomLocation()
              .setFieldCountry("BR")
              .setFieldCustomType("multi_city")
              .setFieldMaxPopulation(1000000L)
              .setFieldMinPopulation(500000L)
          , 
            new TargetingGeoLocationCustomLocation()
              .setFieldCountryGroup("Asia")
              .setFieldCustomType("multi_city")
          ))
          .setFieldLocationTypes(Arrays.asList("recent", "home"))
      )
      .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network"))
  )
  .setStatus(AdSet.EnumStatus.VALUE_PAUSED)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My AdSet' \
  -F 'optimization_goal=REACH' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'bid_amount=2' \
  -F 'daily_budget=1000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={ 
    "geo_locations": { 
      "custom_locations": [ 
        { 
          "custom_type": "multi_city", 
          "min_population": 500000, 
          "max_population": 1000000, 
          "country": "BR" 
        }, 
        {"custom_type":"multi_city","country_group":"Europe"} 
      ], 
      "location_types": ["recent","home"] 
    } 
  }' \
  -F 'status=ACTIVE' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Targeting nach Interessen

Ziele anhand von Interessen aus der Chronik, mit „Gefällt mir“ markierten Seiten oder mit genutzten Seiten oder Apps verbundenen Suchbegriffen auf Personen ab. Siehe Targeting-Suche, Interessen.

Sende folgenden Aufruf, um dich an Personen zu richten, die sich für Fußball interessieren:

use FacebookAds\Object\TargetingSearch;
use FacebookAds\Object\Search\TargetingSearchTypes;

$result = TargetingSearch::search(
  TargetingSearchTypes::INTEREST,
  null,
  'soccer');
from facebookads.adobjects.targetingsearch import TargetingSearch
params = {
    'q': 'soccer',
    'type': 'adinterest',
}

resp = TargetingSearch.search(params=params)
print(resp)
curl -G \
  -d 'type=adinterest' \
  -d 'q=soccer' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/search

Füge dieses Interesse über name und id zu einer Targeting-Spezifikation hinzu, bei der path den Pfad dieses Interesses bei Werbe-Tools darstellt.

curl -X POST \ -F 'name="My First AdSet"' \ -F 'daily_budget=10000' \ -F 'bid_amount=300' \ -F 'billing_event="IMPRESSIONS"' \ -F 'optimization_goal="REACH"' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'promoted_object={ "page_id": "<PAGE_ID>" }' \ -F 'targeting={ "facebook_positions": [ "feed" ], "geo_locations": { "countries": [ "US" ], "regions": [ { "key": "4081" } ], "cities": [ { "key": 777934, "radius": 10, "distance_unit": "mile" } ] }, "genders": [ 1 ], "age_max": 24, "age_min": 20, "publisher_platforms": [ "facebook", "audience_network" ], "device_platforms": [ "mobile" ], "flexible_spec": [ { "interests": [ { "id": "<INTEREST_ID>", "name": "<INTEREST_NAME>" } ] } ] }' \ -F 'status="PAUSED"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v20.0/act_<AD_ACCOUNT_ID>/adsets
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdSet = bizSdk.AdSet; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My First AdSet', 'daily_budget' : '10000', 'bid_amount' : '300', 'billing_event' : 'IMPRESSIONS', 'optimization_goal' : 'REACH', 'campaign_id' : '<adCampaignLinkClicksID>', 'promoted_object' : {'page_id':'<pageID>'}, 'targeting' : {'facebook_positions':['feed'],'geo_locations':{'countries':['US'],'regions':[{'key':'4081'}],'cities':[{'key':777934,'radius':10,'distance_unit':'mile'}]},'genders':[1],'age_max':24,'age_min':20,'publisher_platforms':['facebook','audience_network'],'device_platforms':['mobile'],'flexible_spec':[{'interests':[{'id':'<adsInterestID>','name':'<adsInterestName>'}]}]}, 'status' : 'PAUSED', }; const adsets = (new AdAccount(id)).createAdSet( fields, params ); logApiCallResult('adsets api call complete.', adsets);
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);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adset import AdSet from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My First AdSet', 'daily_budget': '10000', 'bid_amount': '300', 'billing_event': 'IMPRESSIONS', 'optimization_goal': 'REACH', 'campaign_id': '<adCampaignLinkClicksID>', 'promoted_object': {'page_id':'<pageID>'}, 'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US'],'regions':[{'key':'4081'}],'cities':[{'key':777934,'radius':10,'distance_unit':'mile'}]},'genders':[1],'age_max':24,'age_min':20,'publisher_platforms':['facebook','audience_network'],'device_platforms':['mobile'],'flexible_spec':[{'interests':[{'id':'<adsInterestID>','name':'<adsInterestName>'}]}]}, 'status': 'PAUSED', } print AdAccount(id).create_ad_set( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdSet() .setName(\"My First AdSet\") .setDailyBudget(10000L) .setBidAmount(300L) .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) .setCampaignId(\"<adCampaignLinkClicksID>\") .setPromotedObject(\"{\\"page_id\\":\\"<pageID>\\"}\") .setTargeting( new Targeting() .setFieldAgeMax(24L) .setFieldAgeMin(20L) .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE)) .setFieldFacebookPositions(Arrays.asList(\"feed\")) .setFieldFlexibleSpec(Arrays.asList( new FlexibleTargeting() .setFieldInterests(Arrays.asList( new IDName() .setFieldId(\"<adsInterestID>\") .setFieldName(\"<adsInterestName>\") )) )) .setFieldGenders(Arrays.asList(1L)) .setFieldGeoLocations( new TargetingGeoLocation() .setFieldCities(Arrays.asList( new TargetingGeoLocationCity() .setFieldDistanceUnit(\"mile\") .setFieldKey(777934L) .setFieldRadius(10L) )) .setFieldCountries(Arrays.asList(\"US\")) .setFieldRegions(Arrays.asList( new TargetingGeoLocationRegion() .setFieldKey(\"4081\") )) ) .setFieldPublisherPlatforms(Arrays.asList(\"facebook\", \"audience_network\")) ) .setStatus(AdSet.EnumStatus.VALUE_PAUSED) .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adsets = ad_account.adsets.create({ name: 'My First AdSet', daily_budget: '10000', bid_amount: '300', billing_event: 'IMPRESSIONS', optimization_goal: 'REACH', campaign_id: '<adCampaignLinkClicksID>', promoted_object: {'page_id':'<pageID>'}, targeting: {'facebook_positions':['feed'],'geo_locations':{'countries':['US'],'regions':[{'key':'4081'}],'cities':[{'key':777934,'radius':10,'distance_unit':'mile'}]},'genders':[1],'age_max':24,'age_min':20,'publisher_platforms':['facebook','audience_network'],'device_platforms':['mobile'],'flexible_spec':[{'interests':[{'id':'<adsInterestID>','name':'<adsInterestName>'}]}]}, status: 'PAUSED', })

Hier ist ein weiteres Beispiel:

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My AdSet',
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::BID_AMOUNT => 2,
  AdSetFields::DAILY_BUDGET => 1000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array(
        'US',
      ),
    ),
    TargetingFields::INTERESTS => array(
      array(
        'id' => 6003139266461,
        'name' => 'Movies',
      ),
      array(
        'id' => 6003397425735,
        'name' => 'Tennis',
      ),
      array(
        'id' => 6003659420716,
        'name' => 'Cooking',
      ),
    ),
  )),
));
$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_ACTIVE,
));
from facebookads.adobjects.adset import AdSet

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.targeting: {
        'geo_locations': {
            'countries': ['US'],
        },
        'interests': [
            {
                'id': 6003139266461,
                'name': 'Movies',
            },
            {
                'id': 6003397425735,
                'name': 'Tennis',
            },
            {
                'id': 6003659420716,
                'name': 'Cooking',
            },
        ],
    },
})
adset.remote_create(params={
    'status': AdSet.Status.active,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My AdSet")
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setBidAmount(2L)
  .setDailyBudget(1000L)
  .setCampaignId(<CAMPAIGN_ID>)
  .setTargeting(
    new Targeting()
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCountries(Arrays.asList("US"))
      )
      .setFieldInterests(Arrays.asList(
        new IDName()
          .setFieldId("6003139266461")
          .setFieldName("Movies")
      , 
        new IDName()
          .setFieldId("6003397425735")
          .setFieldName("Tennis")
      , 
        new IDName()
          .setFieldId("6003659420716")
          .setFieldName("Cooking")
      ))
  )
  .setStatus(AdSet.EnumStatus.VALUE_ACTIVE)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My AdSet' \
  -F 'optimization_goal=REACH' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'bid_amount=2' \
  -F 'daily_budget=1000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={ 
    "geo_locations": {"countries":["US"]}, 
    "interests": [ 
      {"id":6003139266461,"name":"Movies"}, 
      {"id":6003397425735,"name":"Tennis"}, 
      {"id":6003659420716,"name":"Cooking"} 
    ] 
  }' \
  -F 'status=ACTIVE' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Verfügbare Felder

Name Beschreibung

interests

Array

Array mit „id“- und optionalen „name“-Feldern: 'interests':[{id: 6003139266461, 'name': 'Movies'}, {id: 6003139266462}, 6003139266463]

Targeting nach Verhalten

Ziele anhand von digitalen Aktivitäten, verwendeten Geräten oder vergangenen oder beabsichtigten Käufen und Reisen auf Personen ab. Zeige Optionen unter Browse an, z. B. Personen, die viel reisen. Siehe Targeting Search API.

use FacebookAds\Object\TargetingSearch;
use FacebookAds\Object\Search\TargetingSearchTypes;

$result = TargetingSearch::search(
  TargetingSearchTypes::TARGETING_CATEGORY,
  'behaviors');
from facebookads.adobjects.targetingsearch import TargetingSearch
params = {
    'type': 'adTargetingCategory',
    'class': 'behaviors',
}

resp = TargetingSearch.search(params=params)
print(resp)
curl -G \
  -d 'type=adTargetingCategory' \
  -d 'class=behaviors' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/search

Füge die Verhaltensweise zu targeting_spec hinzu:

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Values\AdSetBillingEventValues;


$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'My First AdSet',
  AdSetFields::DAILY_BUDGET => 10000,
  AdSetFields::BID_AMOUNT => 300,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::REACH,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::PROMOTED_OBJECT => array(
    'page_id' => <PAGE_ID>,
  ),
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array('JP'),
      'regions' => array(array('key' => '3886')),
      'cities' => array(
        array(
          'key' => '2420605',
          'radius' => 10,
          'distance_unit' => 'mile',
        ),
      ),
    ),
    TargetingFields::GENDERS => array(1),
    TargetingFields::AGE_MIN => 20,
    TargetingFields::AGE_MAX => 24,
    TargetingFields::PUBLISHER_PLATFORMS => array(
      'facebook',
      'audience_network',
    ),
    TargetingFields::DEVICE_PLATFORMS => array('mobile'),
    TargetingFields::INTERESTS => array(
      array(
        'id' => 6003107902433,
        'name' => 'Association football (Soccer)',
      ),
    ),
    TargetingFields::BEHAVIORS => array(
      array(
        'id' => 6002714895372,
        'name' => 'All frequent travelers',
      ),
    ),
  )),
));


$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED,
));
from facebookads.adobjects.adset import AdSet
from facebookads.adobjects.targeting import Targeting

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'My AdSet',
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 150,
    AdSet.Field.daily_budget: 2000,
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.promoted_object: {'page_id': <PAGE_ID>},
    AdSet.Field.targeting: {
        Targeting.Field.geo_locations: {
            'countries': ['JP'],
            'regions': [
                {'key': '3886'},
            ],
            'cities': [
                {
                    'key': '2420605',
                    'radius': '10',
                    'distance_unit': 'mile',
                },
            ],
        },
        Targeting.Field.genders: [1],
        Targeting.Field.age_min: 20,
        Targeting.Field.age_max: 24,
        Targeting.Field.publisher_platforms: ['facebook', 'audience_network'],
        Targeting.Field.device_platforms: ['mobile'],
        Targeting.Field.interests: [
            {
                'id': 6003107902433,
                'name': 'Association football (Soccer)',
            },
        ],
        Targeting.Field.behaviors: [
            {
                'id': 6002714895372,
                'name': 'All frequent travelers',
            },
        ],
    },
})
adset.remote_create(params={
    'status': AdSet.Status.active,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
  .setName("My First AdSet")
  .setDailyBudget(10000L)
  .setBidAmount(300L)
  .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
  .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH)
  .setCampaignId(<CAMPAIGN_ID>)
  .setPromotedObject("{\"page_id\":\"" + <PAGE_ID> + "\"}")
  .setTargeting(
    new Targeting()
      .setFieldAgeMax(24L)
      .setFieldAgeMin(20L)
      .setFieldBehaviors(Arrays.asList(
        new IDName()
          .setFieldId("6002714895372")
          .setFieldName("All frequent travelers")
      ))
      .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE))
      .setFieldGenders(Arrays.asList(1L))
      .setFieldGeoLocations(
        new TargetingGeoLocation()
          .setFieldCities(Arrays.asList(
            new TargetingGeoLocationCity()
              .setFieldDistanceUnit("mile")
              .setFieldKey("2420605")
              .setFieldRadius(10L)
          ))
          .setFieldCountries(Arrays.asList("JP"))
          .setFieldRegions(Arrays.asList(
            new TargetingGeoLocationRegion()
              .setFieldKey("3886")
          ))
      )
      .setFieldInterests(Arrays.asList(
        new IDName()
          .setFieldId("6003107902433")
          .setFieldName("Association football (Soccer)")
      ))
      .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network"))
  )
  .setStatus(AdSet.EnumStatus.VALUE_PAUSED)
  .execute();
String ad_set_id = adSet.getId();
curl \
  -F 'name=My First AdSet' \
  -F 'daily_budget=10000' \
  -F 'bid_amount=300' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'optimization_goal=REACH' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'promoted_object={"page_id":"<PAGE_ID>"}' \
  -F 'targeting={ 
    "age_max": 24, 
    "age_min": 20, 
    "behaviors": [{"id":6002714895372,"name":"All frequent travelers"}], 
    "device_platforms": ["mobile"], 
    "genders": [1], 
    "geo_locations": { 
      "countries": ["JP"], 
      "regions": [{"key":"3886"}], 
      "cities": [ 
        { 
          "key": "2420605", 
          "radius": 10, 
          "distance_unit": "mile" 
        } 
      ] 
    }, 
    "interests": [{"id":6003107902433,"name":"Association football (Soccer)"}], 
    "publisher_platforms": ["facebook","audience_network"] 
  }' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Ein weiteres Beispiel:

curl -X POST \ -F 'name="My AdSet"' \ -F 'optimization_goal="REACH"' \ -F 'billing_event="IMPRESSIONS"' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'targeting={ "facebook_positions": [ "feed" ], "geo_locations": { "countries": [ "US" ] }, "behaviors": [ { "id": 6007101597783, "name": "Business Travelers" }, { "id": 6004386044572, "name": "Android Owners (All)" } ] }' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v20.0/act_<AD_ACCOUNT_ID>/adsets
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdSet = bizSdk.AdSet; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My AdSet', 'optimization_goal' : 'REACH', 'billing_event' : 'IMPRESSIONS', 'bid_amount' : '2', 'daily_budget' : '1000', 'campaign_id' : '<adCampaignConversionsID>', 'targeting' : {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'behaviors':[{'id':6007101597783,'name':'Business Travelers'},{'id':6004386044572,'name':'Android Owners (All)'}]}, }; const adsets = (new AdAccount(id)).createAdSet( fields, params ); logApiCallResult('adsets api call complete.', adsets);
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);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adset import AdSet from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My AdSet', 'optimization_goal': 'REACH', 'billing_event': 'IMPRESSIONS', 'bid_amount': '2', 'daily_budget': '1000', 'campaign_id': '<adCampaignConversionsID>', 'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'behaviors':[{'id':6007101597783,'name':'Business Travelers'},{'id':6004386044572,'name':'Android Owners (All)'}]}, } print AdAccount(id).create_ad_set( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdSet() .setName(\"My AdSet\") .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) .setBidAmount(2L) .setDailyBudget(1000L) .setCampaignId(\"<adCampaignConversionsID>\") .setTargeting( new Targeting() .setFieldBehaviors(Arrays.asList( new IDName() .setFieldId(6007101597783L) .setFieldName(\"Business Travelers\") , new IDName() .setFieldId(6004386044572L) .setFieldName(\"Android Owners (All)\") )) .setFieldFacebookPositions(Arrays.asList(\"feed\")) .setFieldGeoLocations( new TargetingGeoLocation() .setFieldCountries(Arrays.asList(\"US\")) ) ) .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adsets = ad_account.adsets.create({ name: 'My AdSet', optimization_goal: 'REACH', billing_event: 'IMPRESSIONS', bid_amount: '2', daily_budget: '1000', campaign_id: '<adCampaignConversionsID>', targeting: {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'behaviors':[{'id':6007101597783,'name':'Business Travelers'},{'id':6004386044572,'name':'Android Owners (All)'}]}, })

Verfügbare Felder

Name Beschreibung

behaviors

Array

Array mit „id“- und optionalen „name“-Feldern: 'behaviors':[{id: 6004386044572, 'name': 'Android Owners (All)'}, {id: 6004386044573}, 6004386044574]

Ressourcen

Sonstige Targeting-Arten:

  • Audience Network – Schalte Anzeigen im Audience Network und vergrößere die Reichweite deiner Link Ads oder App Ads.