adgroup = AdGroup(parent_id=ad_account_id) adgroup[AdGroup.Field.name] = 'test' adgroup[AdGroup.Field.campaign_id] = ad_set_id adgroup[AdGroup.Field.creative] = { 'creative_id': creative_id } adgroup[AdGroup.Field.tracking_specs] = { 'action.type': 'app_install', 'application': app_id } adgroup.remote_create() # _DOC close [ADGROUP_CREATE_TRACKING_APP_INSTALLS] adgroup.remote_delete() object_story_id = fixtures.create_post( message=fixtures.unique_name('Test Post '))['id'] post_id = string.split(object_story_id, '_')[1] # _DOC open [ADGROUP_CREATE_TRACKING_POST_LIKES] # _DOC vars [ad_account_id:s, ad_set_id, creative_id, object_story_id, page_id] from facebookads.objects import AdGroup adgroup = AdGroup(parent_id=ad_account_id) adgroup[AdGroup.Field.name] = 'test' adgroup[AdGroup.Field.campaign_id] = ad_set_id adgroup[AdGroup.Field.creative] = { 'object_story_id': object_story_id } adgroup[AdGroup.Field.tracking_specs] = { 'action.type': 'like',
creative = AdCreative(creative_id) fields = [AdCreative.Field.thumbnail_url] params = { 'thumbnail_width': 150, 'thumbnail_height': 120, } creative.remote_read(fields=fields, params=params) print(creative[AdCreative.Field.thumbnail_url]) # _DOC close [ADCREATIVE_READ_THUMBNAIL_WITH_DIMENSIONS] creative.remote_delete() creative_id = fixtures.create_creative().get_id_assured() creative_name = fixtures.unique_name('Test Creative') # _DOC open [ADCREATIVE_UPDATE] # _DOC vars [creative_id, creative_name] from facebookads.objects import AdCreative creative = AdCreative(creative_id) creative[AdCreative.Field.name] = creative_name creative.remote_update() print(creative) # _DOC close [ADCREATIVE_UPDATE] # _DOC open [ADCREATIVE_CREATE_GET_DIRECTIONS_VIDEO] # _DOC vars [video_image_url:s, video_id, page_id, ad_account_id:s]
from facebookads.objects import AdGroup adgroup = AdGroup(parent_id=ad_account_id) adgroup[AdGroup.Field.name] = 'test' adgroup[AdGroup.Field.campaign_id] = ad_set_id adgroup[AdGroup.Field.creative] = {'creative_id': creative_id} adgroup[AdGroup.Field.tracking_specs] = { 'action.type': 'app_install', 'application': app_id } adgroup.remote_create() # _DOC close [ADGROUP_CREATE_TRACKING_APP_INSTALLS] adgroup.remote_delete() object_story_id = fixtures.create_post( message=fixtures.unique_name('Test Post '))['id'] post_id = string.split(object_story_id, '_')[1] # _DOC open [ADGROUP_CREATE_TRACKING_POST_LIKES] # _DOC vars [ad_account_id:s, ad_set_id, creative_id, object_story_id, page_id] from facebookads.objects import AdGroup adgroup = AdGroup(parent_id=ad_account_id) adgroup[AdGroup.Field.name] = 'test' adgroup[AdGroup.Field.campaign_id] = ad_set_id adgroup[AdGroup.Field.creative] = {'object_story_id': object_story_id} adgroup[AdGroup.Field.tracking_specs] = { 'action.type': 'like', 'post': post_id, 'post.wall': page_id