facebook graph api - Specifying a FB Page for a desktop/mobile news feed ad using Python SDK -


i'm new facebook ads python sdk , trying create ad display on mobile , desktop news feeds. reviewing web flow create ad, show in feed, ad needs related facebook page. manage facebook page, not sure need input fb page info.

i've reviewed documentation , getting started examples, getting started page post ad, not relevant me. assumed "placements" relevant nothing find there helpful either. looked @ connection objects seemed dead end.

the code i've got runs , creates ads right column ads. i've tried adding "page_types: ['feed']" adset targeting returns error saying placement ineligible ad.

could point me in right direction on how create ad show in desktop news feed? meat of code below.

`

# create campaign campaign = adcampaign(parent_id=config['act_account_id']) campaign[adcampaign.field.name] = 'test campaign' campaign[adcampaign.field.status] = adcampaign.status.paused campaign[adcampaign.field.objective] = adcampaign.objective.website_clicks campaign.remote_create()  # create adset targeting = {     #'page_types': ['feed'],     'geo_locations': {         'cities': [{'key': '2532348', 'radius': 25, 'distance_unit': 'mile'}]     } }  data = {     adset.field.name: 'my python sdk adset',     adset.field.bid_type: adset.bidtype.cpc,     adset.field.is_autobid: true,     adset.field.status: adset.status.active,     adset.field.lifetime_budget: 500,     adset.field.end_time: '2015-06-4 23:59:59 pdt',     adset.field.campaign_group_id: config['campaign_id'],     adset.field.targeting: targeting, }  adset = adset(parent_id=config['act_account_id']) adset.remote_create(params=data)  # set creative ad image = adimage(parent_id=config['act_account_id']) image[adimage.field.filename] = image_filename image.remote_create()  creative = adcreative(parent_id=config['act_account_id']) creative[adcreative.field.name] = 'sample creative' creative[adcreative.field.title] = 'ad headline' creative[adcreative.field.body] = 'ad text' creative[adcreative.field.object_url] = 'www.http://www.misc-url.com' creative[adcreative.field.image_hash] = image[adimage.field.hash] creative.remote_create()  # create ad referencing ad creative. adgroup = adgroup(parent_id=config['act_account_id']) adgroup[adgroup.field.name] = 'testing sdk ad' adgroup[adgroup.field.campaign_id] = config['adset_id'] adgroup[adgroup.field.creative] = {'creative_id': str(creative_id)} adgroup[adgroup.field.status] = adgroup.status.paused adgroup.remote_create() 

`

there api call create page post @ time of ad creation:

https://developers.facebook.com/docs/marketing-api/adcreative/v2.3#object_story_spec

see blog post more detailed info:

https://developers.facebook.com/ads/blog/post/2014/08/28/creative-page-post-api


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -