简体   繁体   中英

Facebook Marketing API Accessing Insights

I am trying to access information about my Campaign but I am having trouble with getting cpc, cpv etc. I am using java facebook ads sdk and implementing it in my java application.

This helps me getting today spends:

System.out.println(account.getInsights().setDatePreset(com.facebook.ads.sdk.AdsInsights.EnumDatePreset.VALUE_LAST_3_DAYS).execute().get(0).getFieldSpend());

And it is working fine. But what I need is more information, like inline clicks etc. This command returns null and I am not able to get any of those:

System.out.println(account.getInsights().setDatePreset(com.facebook.ads.sdk.AdsInsights.EnumDatePreset.VALUE_LAST_3_DAYS).execute().get(0).getFieldInlineLinkClicks());

Same is for getFieldCpc() and others. Pleas help. Thanks.

You need to explicitly request the fields you want.

Try to put ".requestField("inline_link_clicks")" before "execute()".

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