我正在使用NodeJS SDK创建活动,上传创意,然后创建AdSet和广告。
在创建AdSet时,我遇到了配置目标对象的问题。
请考虑以下几点:
const targeting = new Targeting();
targeting[Targeting.Fields.countries] = ['US'];
targeting[Targeting.Fields.country] = 'US';当对我的adSet使用这个目标时,我得到以下错误:
"name": "FacebookRequestError",
"message": "Missing Target Audience Location: Your audience is missing a location. You can add a location or a Custom Audience.",
"status": 400,
"response": {
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_data": {
"blame_field_specs": [
[
"targeting"
]
]
},
"error_subcode": 1885364,
"is_transient": false,
"error_user_title": "Missing Target Audience Location",
"error_user_msg": "Your audience is missing a location. You can add a location or a Custom Audience.",
}
},如果我尝试这样填写字段geo_locations:
targeting[Targeting.Fields.geo_locations] = { countries: ['US'] };我得到以下错误:
"name": "FacebookRequestError",
"message": "Invalid Targeting Spec: The specified targeting spec is not valid because: The field _data is not a valid target spec field",
"status": 400,
"response": {
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_data": "null",
"error_subcode": 1487079,
"is_transient": false,
"error_user_title": "Invalid Targeting Spec",
"error_user_msg": "The specified targeting spec is not valid because: The field _data is not a valid target spec field",
}
},在阅读了文档、源代码和互联网上的示例后,我不明白我应该如何解决这个问题,并正确地为这个AdSet设置目标
发布于 2020-07-24 15:20:56
我意识到关于Targeting和AdSet对象关系的文档是错误的。它指定here创建一个Targeting对象并将其传递给PHP和JAVA的AdSet对象,如下所示
$adset->setData(array(
AdSetFields::NAME => 'My AdSet',
AdSetFields::TARGETING => (new Targeting())->setData(array(
TargetingFields::GEO_LOCATIONS => array(
'countries' => array(
'US',
),
),
)),
));我能够通过简单地这样做而不是使用SDK提供的类Targeting来解决这个问题。
const targeting = {
geo_locations: {
countries: ['US'],
},
};
const adSet = new AdSet(accountId);
adSet[AdSet.Fields.targeting] = targeting;
adSet[AdSet.Fields.name] = 'Test Ad Set';要么文档中应该有NodeJS示例,要么SDK已经损坏,需要修复。
https://stackoverflow.com/questions/63015660
复制相似问题