Can you gate and target a page post through the facebook graph api?

↘锁芯ラ 提交于 2019-12-01 05:54:22

IT IS POSSIBLE!

  1. Make sure that gating is turned on for the page

  2. Make sure that you use the page token not the user token.

  3. Then when you create you're post with the api the targeting param will perform gating while the feed_targeting param will do news feed targeting.

Note: Gating only works for language and country.

Can somebody post a bit of example code for locales and countries? There is really nothing in the api and the net overall although this feature is so powerful!

Code example that worked for me:

    curl -F 'access_token=[page_access_token]' 
         -F 'message=Testing post to certain language' 
         -F 'link=http://stackoverflow.com/questions/15280604/can-you-gate-and-target-a-page-post-through-the-facebook-graph-api' 
         -F 'feed_targeting={'locales':[1001]}' 
    https://graph.facebook.com/[pageID]/feed

To get language numbers:

    curl -G -d "access_token=xx" -d"q=en"  
            -d "type=adlocale" 
    https://graph.facebook.com/search

A bit of help is the Targeting from the ads api doc but only some fields are possible for post targeting.

To get locales,city,... codes graph search via curl

Hope this helps someone!

In your your code while adding the parameters use "targeting" instead of "feed_targeting", that worked with me

I have made targeting script I have checked: Post privacy gating is on script uses page access token Passing parametes to feed_targeting

But script posts on Facebook page posts as just public. what I can do ?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!