# 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 AdCampaign ad_account_id = test_config.account_id page_id = test_config.page_id connections_id = page_id campaign_group_id = fixtures.create_adcampaign().get_id_assured() ad_set_id = fixtures.create_adset().get_id_assured() product_catalog_id = test_config.product_catalog_id product_set_id = test_config.product_set_id # _DOC open [ADSET_CREATE] # _DOC vars [ad_account_id:s, campaign_group_id] from facebookads.objects import AdSet, TargetingSpecsField adset = AdSet(parent_id=ad_account_id) adset.update({ AdSet.Field.name: 'My Ad Set', AdSet.Field.campaign_group_id: campaign_group_id, AdSet.Field.daily_budget: 1000, AdSet.Field.billing_event: AdSet.BillingEvent.impressions, AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach, AdSet.Field.bid_amount: 2,
# 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 ad_account_id = test_config.account_id page_id = test_config.page_id ad_set_id = fixtures.create_adset().get_id() creative_id = fixtures.create_creative().get_id() # _DOC open [ADGROUP_CREATE_TRACKING_LIKE_MENTIONS] # _DOC vars [ad_account_id:s, ad_set_id, creative_id, post_id, page_id] from facebookads.objects import Ad ad = Ad(parent_id=ad_account_id) ad[Ad.Field.name] = 'test' ad[Ad.Field.adset_id] = ad_set_id ad[Ad.Field.creative] = { 'creative_id': creative_id } ad[Ad.Field.tracking_specs] = { 'action.type': ['like', 'mention'], 'page': page_id
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. import time from examples.docs import fixtures from facebookads import test_config from facebookads.objects import AdSet ad_account_id = test_config.account_id ad_set_id = fixtures.create_adset(params={ AdSet.Field.daily_budget: None, AdSet.Field.lifetime_budget: 100000, AdSet.Field.end_time: int(time.time() + 7 * 24 * 3600), AdSet.Field.pacing_type: [AdSet.PacingType.day_parting], AdSet.Field.adset_schedule: [ { 'start_minute': 540, 'end_minute': 720, 'days': [1, 2, 3, 4, 5], }, ], }).get_id() # !_DOC [pruno] # _DOC open [ADSET_UPDATE_NO_SCHEDULE] # _DOC vars [ad_account_id:s, ad_set_id] from facebookads.objects import AdSet adset = AdSet(fbid=ad_set_id, parent_id=ad_account_id) adset.update({ AdSet.Field.pacing_type: [AdSet.PacingType.standard],