当前位置: 首页>>代码示例>>Python>>正文


Python objects.AdSet类代码示例

本文整理汇总了Python中facebookads.objects.AdSet的典型用法代码示例。如果您正苦于以下问题:Python AdSet类的具体用法?Python AdSet怎么用?Python AdSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AdSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_adsets

def get_adsets(adset_id):
    adset = AdSet(adset_id)
    fields = [
        AdSet.Field.name,
    ]
    adset.remote_read(fields=fields)
    return adset
开发者ID:prwelber,项目名称:fb_marketing_api_practice,代码行数:7,代码来源:adsets_practice.py

示例2: copy

    def copy(self):
        store_url = config['link_url'][self.param['account']][self.param['os']]
        link_url = store_url.replace('https://', 'http://')
        campaign = AdCampaign(self.param['campaign_id'])
        campaign.remote_read(
            fields=[
                AdCampaign.Field.name
            ]
        )

        adset = AdSet(self.param['adset_id'])
        adset.remote_read(
            fields=[
                AdSet.Field.name,
                AdSet.Field.daily_budget,
                AdSet.Field.pacing_type,
                AdSet.Field.promoted_object,
                AdSet.Field.targeting,
                AdSet.Field.is_autobid,
                AdSet.Field.billing_event,
                AdSet.Field.optimization_goal,
                AdSet.Field.bid_amount,
                AdSet.Field.rtb_flag
            ]
        )
        # pp.pprint(adset)

        adgroups = adset.get_ad_groups(
            fields=[
                AdGroup.Field.name,
                AdGroup.Field.creative,
                AdGroup.Field.tracking_specs,
                AdGroup.Field.status
            ],
            params={
                AdGroup.Field.status: ['ACTIVE']
            }
        )
        # pp.pprint(adgroups)

        object_store_url = adset['promoted_object']['object_store_url']
        replace_url = object_store_url.replace('https://', 'http://')
        if link_url != replace_url:
            return self.different_os_copy(campaign, adset, adgroups)
        else:
            return self.same_os_copy(campaign, adset, adgroups)
开发者ID:mixi-adtech,项目名称:facebook-tool,代码行数:46,代码来源:copy_ad_set_below.py

示例3: create_adset

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
开发者ID:govind1246,项目名称:python-flask-dokku-app,代码行数:20,代码来源:sample_main.py

示例4: create_adset

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
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:23,代码来源:fixtures.py

示例5: create_ad_set

 def create_ad_set(self, account_id, name, daily_budget, campaign_id,
                   optimization_goal, billing_event, bid_amount,
                   targeting, app_id, app_store_link):
     """
     create an ad set in campaign we just created.
     """
     pdata = {
         AdSet.Field.name: name,
         AdSet.Field.optimization_goal: optimization_goal,
         AdSet.Field.billing_event: billing_event,
         AdSet.Field.bid_amount: bid_amount,
         AdSet.Field.daily_budget: daily_budget,
         AdSet.Field.campaign_id: campaign_id,
         AdSet.Field.promoted_object: {
             'application_id': app_id,
             'object_store_url': app_store_link
         },
         AdSet.Field.targeting: targeting,
     }
     pdata['status'] = AdSet.Status.paused
     adset = AdSet(parent_id=account_id)
     adset.remote_create(params=pdata)
     return adset[AdSet.Field.id]
开发者ID:adi69,项目名称:automated-f-ads,代码行数:23,代码来源:app_install_ad_sample.py

示例6: AdSet

# 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
campaign_id = fixtures.create_campaign().get_id_assured()
page_id = test_config.page_id

# _DOC oncall [paulbain]
# _DOC open [ADSET_CREATE_BEHAVIORAL_TARGETING]
# _DOC vars [ad_account_id:s, campaign_id, page_id]
from facebookads.objects import AdSet, TargetingSpecsField

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.promoted_object: {'page_id': page_id},
    AdSet.Field.targeting: {
        TargetingSpecsField.geo_locations: {
            'countries': ['JP'],
            'regions': [
                {'key': '3886'},
            ],
            'cities': [
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_BEHAVIORAL_TARGETING.py

示例7: AdSet

from facebookads import test_config
from facebookads.objects import Campaign

ad_account_id = test_config.account_id
app_id, app_store_url = fixtures.get_promotable_ios_app()
params = {
    Campaign.Field.objective: Campaign.Objective.conversions,
}
campaign_id = fixtures.create_campaign(params).get_id_assured()

# _DOC open [ADSET_CREATE_CPA_APP_EVENTS]
# _DOC vars [ad_account_id:s, app_id, campaign_id, app_store_url:s]
import time
from facebookads.objects import AdSet

adset = AdSet(parent_id=ad_account_id)
adset.update({
    AdSet.Field.name: 'LifetimeBudgetSet',
    AdSet.Field.campaign_id: campaign_id,
    AdSet.Field.lifetime_budget: 10000,
    AdSet.Field.start_time: int(time.time()),
    AdSet.Field.end_time: int(time.time() + 100000),
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.offsite_conversions,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 500,
    AdSet.Field.promoted_object: {
        'application_id': app_id,
        'object_store_url': app_store_url,
        'custom_event_type': 'ADD_TO_CART',
    },
    AdSet.Field.targeting: {
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_CPA_APP_EVENTS.py

示例8: Campaign

    ### Get first account connected to the user
    my_account = me.get_ad_account()
    ### Create a Campaign
    campaign = Campaign(parent_id=my_account.get_id_assured())
    campaign.update({
        Campaign.Field.name: 'Seattle Ad Campaign',
        Campaign.Field.objective: 'LINK_CLICKS',
        Campaign.Field.effective_status: Campaign.Status.paused,
    })
    campaign.remote_create()
    print("**** DONE: Campaign created:")
    pp.pprint(campaign)

    ### Create an Ad Set
    ad_set = AdSet(parent_id=my_account.get_id_assured())
    ad_set.update({
        AdSet.Field.name: 'Puget Sound AdSet',
        AdSet.Field.effective_status: AdSet.Status.paused,
        AdSet.Field.daily_budget: 3600,  # $36.00
        AdSet.Field.billing_event: 'IMPRESSIONS',  # $36.00
        AdSet.Field.is_autobid: 'true',  # $36.00
        AdSet.Field.start_time: int(time.time()) + 15,  # 15 seconds from now
        AdSet.Field.campaign_id: campaign.get_id_assured(),
        AdSet.Field.targeting: {
            TargetingSpecsField.geo_locations: {
                'countries': [
                    'US',
                ],
            },
        },
开发者ID:scottydelta,项目名称:facebook-python-ads-sdk,代码行数:30,代码来源:create_ad.py

示例9: AdSet

# DEALINGS IN THE SOFTWARE.


from examples.docs import fixtures
from facebookads import test_config

ad_account_id = test_config.account_id
campaign_id = fixtures.create_campaign().get_id()
product_set_id = fixtures.create_product_set().get_id()
dynamic_audience_id = fixtures.create_product_audience(product_set_id).get_id()

# _DOC open [ADSET_CREATE_PRODUCT_CATALOG_SALES_VIEWED_DAYS_RETENTION]
# _DOC vars [ad_account_id:s, dynamic_audience_id, campaign_id, product_set_id]
from facebookads.objects import AdSet, TargetingSpecsField

adset = AdSet(parent_id=ad_account_id)
adset[AdSet.Field.name] = 'Product Catalog Sales Adset'
adset[AdSet.Field.bid_amount] = 3000
adset[AdSet.Field.billing_event] = AdSet.BillingEvent.link_clicks
adset[AdSet.Field.optimization_goal] = AdSet.OptimizationGoal.link_clicks
adset[AdSet.Field.daily_budget] = 15000
adset[AdSet.Field.campaign_id] = campaign_id
adset[AdSet.Field.targeting] = {
    TargetingSpecsField.geo_locations: {
        TargetingSpecsField.countries: ['US'],
    },
    TargetingSpecsField.product_audience_specs: [
        {
            'product_set_id': product_set_id,
            'inclusions': [
                {
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_PRODUCT_CATALOG_SALES_VIEWED_DAYS_RETENTION.py

示例10: AdSet

ad_account_id = test_config.account_id
product_catalog_id = fixtures.create_product_catalog().get_id()
product_set_id = fixtures.create_product_set(product_catalog_id).get_id()

params = {
    Campaign.Field.objective: Campaign.Objective.product_catalog_sales,
    Campaign.Field.promoted_object: {'product_catalog_id': product_catalog_id},
}

campaign_id = fixtures.create_campaign(params).get_id_assured()

# _DOC open [ADSET_CREATE_DYNAMIC_PROSPECTIING]
# _DOC vars [ad_account_id:s, product_set_id, campaign_id]
from facebookads.objects import AdSet, TargetingSpecsField

adset = AdSet(parent_id=ad_account_id)
adset[AdSet.Field.name] = 'Case 1 Adset'
adset[AdSet.Field.bid_amount] = 3000
adset[AdSet.Field.billing_event] = AdSet.BillingEvent.link_clicks
adset[AdSet.Field.optimization_goal] = AdSet.OptimizationGoal.link_clicks
adset[AdSet.Field.daily_budget] = 15000
adset[AdSet.Field.campaign_id] = campaign_id
adset[AdSet.Field.targeting] = {
    TargetingSpecsField.geo_locations: {
        TargetingSpecsField.countries: ['US'],
    },
    TargetingSpecsField.interests: [{
        'id': 6003397425735,
        'name': 'Tennis',
    }],
}
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_DYNAMIC_PROSPECTIING.py

示例11: AdSet

# 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
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'],
    },
})
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_APP_CONNECTIONS_TARGETING.py

示例12: AdSet

# 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
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)
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_CONVERSIONS_PURCHASE.py

示例13: AdSet

# 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
campaign_id = fixtures.create_campaign().get_id_assured()

# _DOC open [ADSET_CREATE_FLEXIBLE_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'],
        },
        'age_min': 18,
        'age_max': 43,
        'flexible_spec': [
            {
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_FLEXIBLE_TARGETING.py

示例14: AdSet

# 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
campaign_id = fixtures.create_campaign().get_id_assured()

# _DOC open [ADSET_CREATE_LOCATION_DEMOGRAPHIC_INTERESTS_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': {
            'regions': [{
                'key': '3847'
            }],
            'cities': [
                {
                    'key': '2430536',
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:31,代码来源:ADSET_CREATE_LOCATION_DEMOGRAPHIC_INTERESTS_TARGETING.py

示例15: AdSet

# 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

ad_set_id = fixtures.create_adset().get_id()

# _DOC open [ADSET_GET_INSIGHTS_LEVEL_ADGROUP]
# _DOC vars [ad_set_id]
from facebookads.objects import AdSet, Insights

adset = AdSet(fbid=ad_set_id)
params = {
    'level': Insights.Level.ad
}

stats = adset.get_insights(params=params)
print(stats)
# _DOC close [ADSET_GET_INSIGHTS_LEVEL_ADGROUP]
开发者ID:dud3,项目名称:facebook-python-ads-sdk,代码行数:29,代码来源:ADSET_GET_INSIGHTS_LEVEL_ADGROUP.py


注:本文中的facebookads.objects.AdSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。