简体   繁体   中英

Facebook marketing API: How to get the optimization event

Using the NodeJs (and also the REST API) Facebook marketing API I'm trying to know which Ad Sets are optimizing which event (e,g, add_to_wishlist )

To do that I'm fetching all ad sets:

import bizSdk = require('facebook-nodejs-business-sdk'); // v8.0.0

bizSdk.FacebookAdsApi.init('myaccesstoken')
const adAccount = new bizSdk.AdAccount('act_XXXXX');
const adSets= await adAccount.getAdSets([bizSdk.AdSet.Fields.optimization_sub_event,bizSdk.AdSet.Fields.optimization_goal]);

I always get NONE for the optimization_sub_event field and VALUE or OFFSITE_CONVERSIONS for optimization_goal

More over, I tried to fetch ALL fields possible and look for my event names but without success.

Is there away to achieve that using the API?

Fetch the field promoted_object . The value for a custom event will have this structure:

promoted_object: {
  "application_id": "994*******818",
  "custom_event_type": "OTHER",
  "object_store_url": "http://play.google.com/store/apps/details?id=com.*****",
  "custom_event_str": "my_custom_event_name" // this is what you want
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM