本文整理汇总了Python中facebookads.objects.AdSet.update方法的典型用法代码示例。如果您正苦于以下问题:Python AdSet.update方法的具体用法?Python AdSet.update怎么用?Python AdSet.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facebookads.objects.AdSet
的用法示例。
在下文中一共展示了AdSet.update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_adset
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
def create_adset(campaign_id):
adset = AdSet(parent_id='act_259842962')
adset.update({
AdSet.Field.name: 'My Ad Set',
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.daily_budget: 10000,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.bid_amount: 2,
AdSet.Field.targeting: {
Targeting.Field.geo_locations: {
'countries': ['IN'],
},
Targeting.Field.age_min: 20,
Targeting.Field.age_max: 24
},
AdSet.Field.status: AdSet.Status.paused,
})
adset.remote_create()
return adset
示例2: create_adset
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
def create_adset(campaign=None, params={}):
if campaign is None:
campaign = create_campaign()
adset = AdSet(parent_id=test_config.account_id)
adset[AdSet.Field.name] = unique_name('Test Adset')
adset[AdSet.Field.campaign_id] = campaign.get_id()
adset[AdSet.Field.targeting] = {
'geo_locations': {
'countries': ['US'],
},
}
adset[AdSet.Field.optimization_goal] = AdSet.OptimizationGoal.impressions
adset[AdSet.Field.billing_event] = AdSet.BillingEvent.impressions
adset[AdSet.Field.bid_amount] = 100
adset[AdSet.Field.daily_budget] = 1000
adset.update(params)
adset.remote_create()
atexit.register(remote_delete, adset)
return adset
示例3: import
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
import time
from facebookads.objects import (
AdSet,
TargetingSpecsField
)
end_date = int(time.time() + 24 * 3600)
ad_set = AdSet(parent_id=ad_account_id)
ad_set.update({
AdSet.Field.name: 'Adset Homepage Ads',
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.daily_budget: 1000,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 100,
AdSet.Field.targeting: {
TargetingSpecsField.page_types: ['logout'],
TargetingSpecsField.geo_locations: {
'countries': ['US'],
},
},
AdSet.Field.end_time: end_date,
})
ad_set.remote_create()
print(ad_set)
# _DOC close [ADSET_CREATE_HOMEPAGE]
ad_set.remote_delete()
示例4: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
ad_account_id = test_config.account_id
connections_id = test_config.page_id
campaign_id = fixtures.create_campaign().get_id_assured()
# _DOC open [ADSET_CREATE_APP_CONNECTIONS_TARGETING]
# _DOC vars [ad_account_id:s, campaign_id, connections_id]
from facebookads.objects import AdSet, TargetingSpecsField
ad_set = AdSet(parent_id=ad_account_id)
ad_set.update({
AdSet.Field.name: 'Android Connections Targeting - Ad Set',
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.post_engagement,
AdSet.Field.billing_event: AdSet.BillingEvent.post_engagement,
AdSet.Field.bid_amount: 1500,
AdSet.Field.daily_budget: 10000,
AdSet.Field.targeting: {
TargetingSpecsField.geo_locations: {
'countries': ['US'],
},
TargetingSpecsField.connections: [connections_id],
TargetingSpecsField.user_os: ['Android'],
},
})
ad_set.remote_create(params={
'status': AdSet.Status.paused,
})
print(ad_set)
# _DOC close [ADSET_CREATE_APP_CONNECTIONS_TARGETING]
示例5: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
from examples.docs import fixtures
from facebookads import test_config
ad_account_id = test_config.account_id
pixel_id = fixtures.create_ads_pixel().get_id()
campaign_id = fixtures.create_campaign().get_id_assured()
# _DOC open [ADSET_CREATE_CONVERSIONS_PURCHASE]
# _DOC vars [ad_account_id:s, campaign_id, pixel_id]
from facebookads.objects import AdSet, TargetingSpecsField
adset = AdSet(parent_id=ad_account_id)
adset.update(
{
AdSet.Field.name: "Ad Set oCPM",
AdSet.Field.bid_amount: 150,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.offsite_conversions,
AdSet.Field.promoted_object: {"pixel_id": pixel_id, "custom_event_type": "PURCHASE"},
AdSet.Field.daily_budget: 1000,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.targeting: {TargetingSpecsField.geo_locations: {"countries": ["US"]}},
}
)
adset.remote_create(params={"status": AdSet.Status.paused})
print(adset)
# _DOC close [ADSET_CREATE_CONVERSIONS_PURCHASE]
adset.remote_delete()
示例6: football
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
adset.update({
AdSet.Field.name: 'My AdSet',
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 150,
AdSet.Field.daily_budget: 2000,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.promoted_object: {'page_id': page_id},
AdSet.Field.targeting: {
TargetingSpecsField.geo_locations: {
'countries': ['JP'],
'regions': [
{'key': '3886'},
],
'cities': [
{
'key': '2420605',
'radius': '10',
'distance_unit': 'mile',
},
],
},
TargetingSpecsField.genders: [1],
TargetingSpecsField.age_min: 20,
TargetingSpecsField.age_max: 24,
TargetingSpecsField.page_types: ['mobilefeed', 'mobileexternal'],
TargetingSpecsField.interests: [
{
'id': 6003107902433,
'name': 'Association football (Soccer)',
},
],
TargetingSpecsField.behaviors: [
{
'id': 6002714895372,
'name': 'All frequent travelers',
},
],
},
})
示例7: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
# _DOC open [ADSET_CREATE_CUSTOM_AUDIENCE_PARTNER_CATEGORIES_TARGETING]
# _DOC vars [ad_account_id:s, campaign_id, custom_audience_id, audience_name]
from facebookads.objects import AdSet
adset = AdSet(parent_id=ad_account_id)
adset.update({
AdSet.Field.name: 'My AdSet',
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 150,
AdSet.Field.daily_budget: 2000,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.targeting: {
'geo_locations': {
'countries': ['US'],
},
'custom_audiences': [
{
'id': custom_audience_id,
'name': audience_name,
},
],
},
})
adset.remote_create(params={
'status': AdSet.Status.active,
})
# _DOC close [ADSET_CREATE_CUSTOM_AUDIENCE_PARTNER_CATEGORIES_TARGETING]
adset.remote_delete()
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:32,代码来源:ADSET_CREATE_CUSTOM_AUDIENCE_PARTNER_CATEGORIES_TARGETING.py
示例8: football
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
ad_set.update({
AdSet.Field.name: 'My First AdSet',
AdSet.Field.lifetime_budget: 20000,
AdSet.Field.start_time: start_time,
AdSet.Field.end_time: end_time,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.bid_amount: 500,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.post_engagement,
AdSet.Field.targeting: {
TargetingSpecsField.geo_locations: {
'countries': ['JP'],
},
TargetingSpecsField.genders: [1],
TargetingSpecsField.age_min: 20,
TargetingSpecsField.age_max: 24,
TargetingSpecsField.interests: [
{
'id': 6003107902433,
'name': 'Association football (Soccer)',
},
],
TargetingSpecsField.behaviors: [
{
'id': 6002714895372,
'name': 'All travelers',
},
],
TargetingSpecsField.life_events: [
{
'id': 6002714398172,
'name': 'Newlywed (1 year)',
},
],
TargetingSpecsField.home_ownership: [
{
'id': 6006371327132,
'name': 'Renters',
},
],
TargetingSpecsField.page_types: [
'desktopfeed',
'rightcolumn',
'mobilefeed',
'mobileexternal',
],
},
})
示例9: str
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
}
# _DOC open [ADSET_CREATE_TARGETING_DATE_RANGE]
# _DOC vars [ad_account_id:s, campaign_id, targeting]
import datetime
from facebookads.objects import AdSet
today = datetime.date.today()
start_time = str(today + datetime.timedelta(weeks=1))
end_time = str(today + datetime.timedelta(weeks=2))
adset = AdSet(parent_id=ad_account_id)
adset.update({
AdSet.Field.name: 'My Ad Set',
AdSet.Field.campaign_id: campaign_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,
AdSet.Field.targeting: targeting,
AdSet.Field.start_time: start_time,
AdSet.Field.end_time: end_time,
})
adset.remote_create(params={
'status': AdSet.Status.paused,
})
# _DOC close [ADSET_CREATE_TARGETING_DATE_RANGE]
adset.remote_delete()
示例10: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
# _DOC vars [campaign_id, ad_account_id:s, app_id, app_store_url:s]
from facebookads.objects import AdSet, TargetingSpecsField
adset = AdSet(parent_id=ad_account_id)
adset.update({
AdSet.Field.name: 'Mobile App Installs Ad Set',
AdSet.Field.promoted_object: {
'application_id': app_id,
'object_store_url': app_store_url,
},
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.daily_budget: 1000,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.app_installs,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 2,
AdSet.Field.targeting: {
TargetingSpecsField.geo_locations: {
'countries': ['US'],
},
TargetingSpecsField.page_types: [
'mobileexternal',
'mobilefeed',
],
TargetingSpecsField.user_os: [
'IOS',
],
},
})
adset.remote_create(params={
'status': AdSet.Status.paused,
})
示例11: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
# _DOC open [ADSET_CREATE_BCT_LOCATION_DEMOGRAPHICS_TARGETING]
# _DOC vars [ad_account_id:s, campaign_id]
from facebookads.objects import AdSet
adset = AdSet(parent_id=ad_account_id)
adset.update({
AdSet.Field.name: 'My AdSet',
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 150,
AdSet.Field.daily_budget: 2000,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.targeting: {
'geo_locations': {
'countries': ['US'],
},
'relationship_statuses': [2],
'user_adclusters': [
{
'id': 6002714886772,
'name': 'Food & Dining',
},
],
},
})
adset.remote_create(params={
'status': AdSet.Status.active,
})
# _DOC close [ADSET_CREATE_BCT_LOCATION_DEMOGRAPHICS_TARGETING]
adset.remote_delete()
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:33,代码来源:ADSET_CREATE_BCT_LOCATION_DEMOGRAPHICS_TARGETING.py
示例12:
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
adset.update({
AdSet.Field.name: 'My AdSet',
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 150,
AdSet.Field.daily_budget: 2000,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.targeting: {
'geo_locations': {
'countries': ['US'],
},
'flexible_spec': [
{
'user_adclusters': [
{
'id': 6002714885172,
'name': 'Cooking',
},
],
},
{
'user_adclusters': [
{
'id': 6006371326532,
'name': 'Demographic > Home > Home Owner > Recent Buyer'
},
],
},
],
},
})
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:33,代码来源:ADSET_CREATE_BCT_PARTNER_CATEGORIES_TARGETING.py
示例13: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
ad_account_id = test_config.account_id
campaign_id = fixtures.create_campaign().get_id_assured()
# _DOC open [ADSET_CREATE_OCPM]
# _DOC vars [ad_account_id:s, campaign_id:s]
from facebookads.objects import AdSet, TargetingSpecsField
# Create an Ad Set with bid_type set to oCPM
adset = AdSet(parent_id=ad_account_id)
adset.update({
AdSet.Field.name: 'My Ad Set for oCPM',
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.link_clicks,
AdSet.Field.bid_amount: 150,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.daily_budget: 1000,
AdSet.Field.targeting: {
TargetingSpecsField.geo_locations: {
'countries': ['US'],
},
},
})
adset.remote_create(params={
'status': AdSet.Status.paused,
})
# _DOC close [ADSET_CREATE_OCPM]
adset.remote_delete()
示例14: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# 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
ad_set_id = fixtures.create_adset().get_id()
# !_DOC [pruno]
# _DOC open [ADSET_UPDATE_PACING_TYPE_STANDARD]
# _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],
})
adset.remote_update()
# _DOC close [ADSET_UPDATE_PACING_TYPE_STANDARD]
示例15: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import update [as 别名]
# _DOC vars [ad_account_id:s, campaign_id]
from facebookads.objects import AdSet
adset = AdSet(parent_id=ad_account_id)
adset.update({
AdSet.Field.name: 'My AdSet',
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.reach,
AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
AdSet.Field.bid_amount: 150,
AdSet.Field.daily_budget: 2000,
AdSet.Field.campaign_id: campaign_id,
AdSet.Field.targeting: {
'geo_locations': {
'countries': ['US'],
},
'behaviors': [
{
'id': 6004386044572,
'name': 'Android Owners (All)',
},
{
'id': 6007101597783,
'name': 'Business Travelers',
},
],
},
})
adset.remote_create(params={
'status': AdSet.Status.active,
})
# _DOC close [ADSET_CREATE_BEHAVIOR_TARGETING]