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',
# shall be included in all copies or substantial portions of the software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. from examples.docs import fixtures from facebookads import test_config from facebookads.objects import AdPreview ad_account_id = test_config.account_id post_id = fixtures.create_post()['id'] format = AdPreview.AdFormat.desktop_feed_standard # _DOC open [ADACCOUNT_GET_PREVIEWS_WITH_OBJECT_STORY_ID] # _DOC vars [ad_account_id:s, post_id:s, format:s] from facebookads.objects import AdAccount, AdPreview, AdCreative account = AdAccount(ad_account_id) params = { AdPreview.Field.creative: { AdCreative.Field.object_story_id: post_id, }, AdPreview.Field.ad_format: format, } account.get_ad_preview(params=params) # _DOC close [ADACCOUNT_GET_PREVIEWS_WITH_OBJECT_STORY_ID]
# _DOC vars [ad_account_id:s, ad_set_id, creative_id, app_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] = {'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