移动应用广告系列

本指南将介绍如何制作和配置以下各种移动应用广告系列,以及如何监控这些广告系列的效果:

通用应用广告系列

利用通用应用广告系列,您可以在 Google 搜索、Google Play、YouTube 和 Google 展示广告网络等 Google 顶级媒体资源上轻松宣传 Android 应用或 iOS 应用。本指南将说明如何制作这种广告系列、设置定位条件以及生成报告。

制作广告系列

1. 创建预算

要制作通用应用广告系列,请先创建预算。通用应用广告系列不支持共享预算,因此您需要将预算的 isExplicitlyShared 属性设置为 false

Java

// Get the BudgetService.
BudgetServiceInterface budgetService =
    adWordsServices.get(session, BudgetServiceInterface.class);

// Create the campaign budget.
Budget budget = new Budget();
budget.setName("Interplanetary Cruise App Budget #" + System.currentTimeMillis());
Money budgetAmount = new Money();
budgetAmount.setMicroAmount(50000000L);
budget.setAmount(budgetAmount);
budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);

// Universal app campaigns don't support shared budgets.
budget.setIsExplicitlyShared(false);
BudgetOperation budgetOperation = new BudgetOperation();
budgetOperation.setOperand(budget);
budgetOperation.setOperator(Operator.ADD);

// Add the budget
Budget addedBudget = budgetService.mutate(new BudgetOperation[] {budgetOperation}).getValue(0);
    

.NET

// Get the BudgetService.
BudgetService budgetService =
  (BudgetService) user.GetService(AdWordsService.v201609.BudgetService);

// Create the campaign budget.
Budget budget = new Budget();
budget.name = "Interplanetary Cruise App Budget #" + ExampleUtilities.GetRandomString();
budget.deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD;
budget.amount = new Money();
budget.amount.microAmount = 5000000;

// Universal app campaigns don't support shared budgets.
budget.isExplicitlyShared = false;

BudgetOperation budgetOperation = new BudgetOperation();
budgetOperation.@operator = Operator.ADD;
budgetOperation.operand = budget;

BudgetReturnValue budgetRetval = budgetService.mutate(
  new BudgetOperation[] { budgetOperation });
    

Python

budget_service = client.GetService('BudgetService', version='v201609')

# Create a budget.
budget = {
    'name': 'Interplanetary Cruise App Budget #%s' % uuid.uuid4(),
    'amount': {
        'microAmount': '50000000'
    },
    'deliveryMethod': 'STANDARD',
    'isExplicitlyShared': False
}

budget_operations = [{
    'operator': 'ADD',
    'operand': budget
}]

# Create the budget and return its ID.
budget_id = budget_service.mutate(budget_operations)['value'][0]['budgetId']
    

PHP

// Get the BudgetService, which loads the required classes.
$budgetService = $user->GetService('BudgetService', ADWORDS_VERSION);

// Create the shared budget (required).
$budget = new Budget();
$budget->name = 'Interplanetary Cruise Budget #' . uniqid();
$budget->amount = new Money(50000000);
$budget->deliveryMethod = 'STANDARD';

// Universal App campaigns don't support shared budgets.
$budget->isExplicitlyShared = false;
$operations = array();

// Create operation.
$operation = new BudgetOperation();
$operation->operand = $budget;
$operation->operator = 'ADD';
$operations[] = $operation;

// Make the mutate request.
$result = $budgetService->mutate($operations);
$budget = $result->value[0];

printf("Budget with name '%s' and ID %d was created.\n",
    $budget->name, $budget->budgetId);
    

Perl

# Create the campaign budget.
my $budget = Google::Ads::AdWords::v201609::Budget->new({
  # Required attributes.
  name => "Interplanetary Cruise App Budget #" . uniqid(),
  amount =>
    Google::Ads::AdWords::v201609::Money->new({microAmount => 5000000}),
  deliveryMethod => "STANDARD",
  # Universal app campaigns don't support shared budgets.
  isExplicitlyShared => 0
});

my $budget_operation = Google::Ads::AdWords::v201609::BudgetOperation->new({
  operator => "ADD",
  operand  => $budget
});

# Add budget.
my $addedBudget =
  $client->BudgetService()->mutate({operations => ($budget_operation)})
  ->get_value();
printf
  "Budget with name '%s' and ID %d was created.\n",
  $addedBudget->get_name(), $addedBudget->get_budgetId()->get_value();
    

Ruby

# Create a budget.
budget = {
  :name => 'Interplanetary budget #%d' % (Time.new.to_f * 1000).to_i,
  :amount => {:micro_amount => 50000000},
  :delivery_method => 'STANDARD',
  # Universal app campaigns don't support shared budgets.
  :is_explicitly_shared => false
}
budget_operation = {:operator => 'ADD', :operand => budget}

# Add the budget.
return_budget = budget_srv.mutate([budget_operation])
budget_id = return_budget[:value].first[:budget_id]
    

有关详细信息,请参阅我们的“广告系列预算”指南

2. 制作广告系列

接下来,制作您的广告系列。在制作通用应用广告系列时,您需要注意以下限制条件:

  1. 广告系列的 advertisingChannelType 必须设置为 MULTI_CHANNELadvertisingChannelSubType 必须设置为 UNIVERSAL_APP_CAMPAIGN
  2. 仅支持 TARGET_CPA 出价策略类型。
  3. 无法对通用应用广告系列设定常规广告系列的许多设置(例如 networkSettingfrequencyCaptrackingUrlTemplate)。有关无法设定的设置的完整列表,请参阅参考文档

Java

// Get the CampaignService.
CampaignServiceInterface campaignService =
    adWordsServices.get(session, CampaignServiceInterface.class);

// Create the campaign.
Campaign campaign = new Campaign();
campaign.setName("Interplanetary Cruise App #" + System.currentTimeMillis());

// Recommendation: Set the campaign to PAUSED when creating it to prevent
// the ads from immediately serving. Set to ENABLED once you've added
// targeting and the ads are ready to serve.
campaign.setStatus(CampaignStatus.PAUSED);

// Set the advertising channel and subchannel types for universal app campaigns.
campaign.setAdvertisingChannelType(AdvertisingChannelType.MULTI_CHANNEL);
campaign.setAdvertisingChannelSubType(AdvertisingChannelSubType.UNIVERSAL_APP_CAMPAIGN);

// Set the campaign's bidding strategy. universal app campaigns
// only support TARGET_CPA bidding strategy.
BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
biddingConfig.setBiddingStrategyType(BiddingStrategyType.TARGET_CPA);

// Set the target CPA to $1 / app install.
TargetCpaBiddingScheme biddingScheme = new TargetCpaBiddingScheme();
biddingScheme.setTargetCpa(new Money());
biddingScheme.getTargetCpa().setMicroAmount(1000000L);

biddingConfig.setBiddingScheme(biddingScheme);
campaign.setBiddingStrategyConfiguration(biddingConfig);

// Set the campaign's budget.
campaign.setBudget(new Budget());
campaign.getBudget().setBudgetId(createBudget(adWordsServices, session));

// Optional: Set the start date.
campaign.setStartDate(new DateTime().plusDays(1).toString("yyyyMMdd"));

// Optional: Set the end date.
campaign.setEndDate(new DateTime().plusYears(1).toString("yyyyMMdd"));
    

.NET

// Get the CampaignService.
CampaignService campaignService =
  (CampaignService) user.GetService(AdWordsService.v201609.CampaignService);

// Create the campaign.
Campaign campaign = new Campaign();
campaign.name = "Interplanetary Cruise App #" + ExampleUtilities.GetRandomString();

// Recommendation: Set the campaign to PAUSED when creating it to prevent
// the ads from immediately serving. Set to ENABLED once you've added
// targeting and the ads are ready to serve.
campaign.status = CampaignStatus.PAUSED;

// Set the advertising channel and subchannel types for universal app campaigns.
campaign.advertisingChannelType = AdvertisingChannelType.MULTI_CHANNEL;
campaign.advertisingChannelSubType = AdvertisingChannelSubType.UNIVERSAL_APP_CAMPAIGN;

// Set the campaign's bidding strategy. Universal app campaigns
// only support TARGET_CPA bidding strategy.
BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
biddingConfig.biddingStrategyType = BiddingStrategyType.TARGET_CPA;

// Set the target CPA to $1 / app install.
TargetCpaBiddingScheme biddingScheme = new TargetCpaBiddingScheme();
biddingScheme.targetCpa = new Money();
biddingScheme.targetCpa.microAmount = 1000000;

biddingConfig.biddingScheme = biddingScheme;
campaign.biddingStrategyConfiguration = biddingConfig;

// Set the campaign's budget.
campaign.budget = new Budget();
campaign.budget.budgetId = CreateBudget(user).budgetId;

// Optional: Set the start date.
campaign.startDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd");

// Optional: Set the end date.
campaign.endDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd");
    

Python

# Initialize appropriate services.
campaign_service = client.GetService('CampaignService', version='v201609')

budget_id = CreateBudget(client)

# Create the Universal App campaign.
universal_app_campaign = {
    'name': 'Interplanetary Cruise App #%s' % uuid.uuid4(),
    'status': 'PAUSED',
    'advertisingChannelType': 'MULTI_CHANNEL',
    'advertisingChannelSubType': 'UNIVERSAL_APP_CAMPAIGN',
    # Set the campaign's bidding strategy. Universal app campaigns only
    # support TARGET_CPA bidding strategy.
    'biddingStrategyConfiguration': {
         # Set the target CPA to $1 / app install.
        'biddingScheme': {
            'xsi_type': 'TargetCpaBiddingScheme',
            'targetCpa': {
                'microAmount': '1000000'
            }
        },
        'biddingStrategyType': 'TARGET_CPA'
    },
    # Note that only the budgetId is required
    'budget': {
        'budgetId': budget_id
    },
    # Optional fields
    'startDate': (datetime.datetime.now() +
                  datetime.timedelta(1)).strftime('%Y%m%d'),
    'endDate': (datetime.datetime.now() +
                datetime.timedelta(365)).strftime('%Y%m%d'),
}
    

PHP

// Get the CampaignService, which loads the required classes.
$campaignService = $user->GetService('CampaignService', ADWORDS_VERSION);

// Create campaign with some properties set.
$campaign = new Campaign();
$campaign->name = 'Interplanetary Cruise #' . uniqid();
// Recommendation: Set the campaign to PAUSED when creating it to stop
// the ads from immediately serving. Set to ENABLED once you've added
// targeting and the ads are ready to serve.
$campaign->status = 'PAUSED';

// Set the advertising channel and subchannel types for Universal app
// campaigns.
$campaign->advertisingChannelType = 'MULTI_CHANNEL';
$campaign->advertisingChannelSubType = 'UNIVERSAL_APP_CAMPAIGN';

// Set the campaign's bidding strategy. Universal App campaigns
// only support TARGET_CPA bidding strategy.
$biddingStrategyConfiguration = new BiddingStrategyConfiguration();
$biddingStrategyConfiguration->biddingStrategyType = 'TARGET_CPA';

// Set the target CPA to $1 / app install.
$biddingScheme = new TargetCpaBiddingScheme();
$biddingScheme->targetCpa = new Money(1000000);

$biddingStrategyConfiguration->biddingScheme = $biddingScheme;
$campaign->biddingStrategyConfiguration = $biddingStrategyConfiguration;

// Set the campaign's budget.
$campaign->budget = new Budget();
$campaign->budget->budgetId = CreateBudget($user);

// Optional: Set the start date.
$campaign->startDate = date('Ymd', strtotime('+1 day'));

// Optional: Set the end date.
$campaign->endDate = date('Ymd', strtotime('+1 year'));
    

Perl

my (undef, undef, undef, $mday, $mon, $year) = localtime(time + 60 * 60 * 24);
my $start_date = sprintf("%d%02d%02d", ($year + 1900), ($mon + 1), $mday);
(undef, undef, undef, $mday, $mon, $year) =
  localtime(time + 60 * 60 * 24 * 365);
my $end_date = sprintf("%d%02d%02d", ($year + 1900), ($mon + 1), $mday);

my $budgetId = create_budget($client);

my $campaign = Google::Ads::AdWords::v201609::Campaign->new({
    name => "Interplanetary Cruise App #" . uniqid(),
    # Bidding strategy (required).
    # Set the campaign's bidding strategy. Universal app campaigns
    # only support TARGET_CPA bidding strategy.
    biddingStrategyConfiguration =>
      Google::Ads::AdWords::v201609::BiddingStrategyConfiguration->new({
        biddingStrategyType => "TARGET_CPA",
        # Set the target CPA to $1 / app install.
        biddingScheme =>
          Google::Ads::AdWords::v201609::TargetCpaBiddingScheme->new({
            targetCpa => Google::Ads::AdWords::v201609::Money->new(
              {microAmount => 1000000})})}
      ),
    # Budget (required) - note only the budgetId is required.
    budget =>
      Google::Ads::AdWords::v201609::Budget->new({budgetId => $budgetId}),
    # Advertising channel type (required).
    # Set the advertising channel and subchannel types for universal
    # app campaigns.
    advertisingChannelType    => "MULTI_CHANNEL",
    advertisingChannelSubType => "UNIVERSAL_APP_CAMPAIGN",
    settings                  => [$universalAppSetting, $geoSetting],
    # Additional properties (non-required).
    startDate => $start_date,
    endDate   => $end_date,
    # Recommendation: Set the campaign to PAUSED when creating it to stop
    # the ads from immediately serving. Set to ENABLED once you've added
    # targeting and the ads are ready to serve.
    status    => "PAUSED"
  });
    

Ruby

campaign_srv = adwords.service(:CampaignService, API_VERSION)
budget_srv = adwords.service(:BudgetService, API_VERSION)

# Create a budget.
budget = {
  :name => 'Interplanetary budget #%d' % (Time.new.to_f * 1000).to_i,
  :amount => {:micro_amount => 50000000},
  :delivery_method => 'STANDARD',
  # Universal app campaigns don't support shared budgets.
  :is_explicitly_shared => false
}
budget_operation = {:operator => 'ADD', :operand => budget}

# Add the budget.
return_budget = budget_srv.mutate([budget_operation])
budget_id = return_budget[:value].first[:budget_id]

# Create campaigns.
universal_app_campaign = {
  :name => "Interplanetary Cruise #%d" % (Time.new.to_f * 1000).to_i,
  # Recommendation: Set the campaign to PAUSED when creating it to stop the
  # ads from immediately serving. Set it to ENABLED once you've added
  # targeting and the ads are ready to serve.
  :status => 'PAUSED',
  # Set the advertising channel and subchannel types for universal app
  # campaigns.
  :advertising_channel_type => 'MULTI_CHANNEL',
  :advertising_channel_sub_type => 'UNIVERSAL_APP_CAMPAIGN',
  # Set the campaign's bidding strategy. Universal app campaigns only support
  # the TARGET_CPA bidding strategy.
  :bidding_strategy_configuration => {
    :bidding_scheme => {
      :xsi_type => 'TargetCpaBiddingScheme',
      :target_cpa => {
        :micro_amount => 1000000
      }
    }
  },
  # Budget (required) - note only the budget ID is required.
  :budget => {:budget_id => budget_id},
  # Optional fields:
  :start_date =>
      DateTime.parse((Date.today + 1).to_s).strftime('%Y%m%d'),
  :end_date =>
      DateTime.parse((Date.today + 365).to_s).strftime('%Y%m%d')
}
    

3. 自定义广告

不同于其他类型的广告系列,通用应用广告系列不允许用户制作广告。系统会根据应用的商品详情、其他文字提示以及您在广告系列的设置中指定的素材资源,使用多种广告格式在多种广告网络上生成广告。以下代码段展示了如何设置广告系列的素材资源。

Java

// Set the campaign's assets and ad text ideas. These values will be used to
// generate ads.
UniversalAppCampaignSetting universalAppSetting = new UniversalAppCampaignSetting();
universalAppSetting.setAppId("com.interplanetarycruise.booking");
universalAppSetting.setDescription1("Best Space Cruise Line");
universalAppSetting.setDescription2("Visit all the planets");
universalAppSetting.setDescription3("Trips 7 days a week");
universalAppSetting.setDescription4("Buy your tickets now!");

// Optional: You can set up to 10 image assets for your campaign.
// See UploadImage.java for an example on how to upload images.
//
// universalAppSetting.setImageMediaIds(new long[] { INSERT_IMAGE_MEDIA_ID_HERE });
    

.NET

// Set the campaign's assets and ad text ideas. These values will be used to
// generate ads.
UniversalAppCampaignSetting universalAppSetting = new UniversalAppCampaignSetting();
universalAppSetting.appId = "com.interplanetarycruise.booking";
universalAppSetting.description1 = "Best Space Cruise Line";
universalAppSetting.description2 = "Visit all the planets";
universalAppSetting.description3 = "Trips 7 days a week";
universalAppSetting.description4 = "Buy your tickets now!";

// Optional: You can set up to 10 image assets for your campaign.
// See UploadImage.cs for an example on how to upload images.
//
// universalAppSetting.imageMediaIds = new long[] { INSERT_IMAGE_MEDIA_ID_HERE };
    

Python

universal_app_campaign['settings'] = [
    # Set the campaign's assets and ad text ideas. These values will
    # be used to generate ads.
    {
        'xsi_type': 'UniversalAppCampaignSetting',
        'appId': 'com.interplanetarycruise.booking',
        'description1': 'Best Space Cruise Line',
        'description2': 'Visit all the planets',
        'description3': 'Trips 7 days a week',
        'description4': 'Buy your tickets now!',
        # Optional: You can set up to 10 image assets for your campaign.
        # See upload_image.py for an example on how to upload images.
        #
        # 'imageMediaIds': [INSERT_IMAGE_MEDIA_ID(s)_HERE]
    }
]
    

PHP

// Set the campaign's assets and ad text ideas. These values will be used to
// generate ads.
$universalAppSetting = new UniversalAppCampaignSetting();
$universalAppSetting->appId = 'com.interplanetarycruise.booking';
$universalAppSetting->description1 = 'Best Space Cruise Line';
$universalAppSetting->description2 = 'Visit all the planets';
$universalAppSetting->description3 = 'Trips 7 days a week';
$universalAppSetting->description4 = 'Buy your tickets now!';

// Optional: You can set up to 10 image assets for your campaign.
// See UploadImage.php for an example on how to upload images.
//
// $universalAppSetting->imageMediaIds = array(INSERT_IMAGE_MEDIA_ID_HERE);
    

Perl

# Set the campaign's assets and ad text ideas. These values will be used to
# generate ads.
my $universalAppSetting =
  Google::Ads::AdWords::v201609::UniversalAppCampaignSetting->new({
    appId        => "com.interplanetarycruise.booking",
    description1 => "Best Space Cruise Line",
    description2 => "Visit all the planets",
    description3 => "Trips 7 days a week",
    description4 => "Buy your tickets now!"
  });

# Optional: You can set up to 10 image assets for your campaign.
# See upload_image.pl for an example on how to upload images.
# universalAppSetting->set_imageMediaIds([INSERT_IMAGE_MEDIA_ID_HERE]);
    

Ruby

universal_app_setting = {
  # Set the campaign's assets and ad text ideas. These values will be used to
  # generate ads.
  :xsi_type => 'UniversalAppCampaignSetting',
  :app_id => 'com.interplanetarycruise.booking',
  :description1 => 'Best Space Cruise Line',
  :description2 => 'Visit all the planets',
  :description3 => 'Trips 7 days a week',
  :description4 => 'Buy your tickets now!'
  # Optional: You can set up to 10 image assets for your campaign. See
  # upload_image.rb for an example on how to upload images.
  #
  # :image_media_ids => [INSERT_IMGAGE_MEDIA_ID(s)_HERE]
}
    

4. 优化广告系列

您可以通过以下两种设置来优化广告系列:利用 universalAppBiddingStrategyGoalType,您可以在优化广告系列的出价策略时,指定目标类型。如果选择 OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME 作为出价策略目标类型,您还可以使用广告系列的 selectiveOptimization 字段,针对一系列应用内转化类型进行优化。您可以使用 ConversionTrackerService 来获取所有转化跟踪代码的列表。

Java

// Optimize this campaign for getting new users for your app.
universalAppSetting.setUniversalAppBiddingStrategyGoalType(
    UniversalAppBiddingStrategyGoalType.OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME);

// If you select the OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME goal type, then also specify
// your in-app conversion types so AdWords can focus your campaign on people who are
// most likely to complete the corresponding in-app actions.
// Conversion type IDs can be retrieved using ConversionTrackerService.get.
//
// campaign.selectiveOptimization = new SelectiveOptimization();
// campaign.selectiveOptimization.conversionTypeIds =
//    new long[] { INSERT_CONVERSION_TYPE_ID_1_HERE, INSERT_CONVERSION_TYPE_ID_2_HERE };

// Optional: Set the campaign settings for Advanced location options.
GeoTargetTypeSetting geoSetting = new GeoTargetTypeSetting();
geoSetting.setPositiveGeoTargetType(
    GeoTargetTypeSettingPositiveGeoTargetType.LOCATION_OF_PRESENCE);
geoSetting.setNegativeGeoTargetType(GeoTargetTypeSettingNegativeGeoTargetType.DONT_CARE);

campaign.setSettings(new Setting[] {universalAppSetting, geoSetting});
    

.NET

// Optimize this campaign for getting new users for your app.
universalAppSetting.universalAppBiddingStrategyGoalType =
    UniversalAppBiddingStrategyGoalType.OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME;

// Optional: If you select the OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME goal
// type, then also specify your in-app conversion types so AdWords can
// focus your campaign on people who are most likely to complete the
// corresponding in-app actions.
// Conversion type IDs can be retrieved using ConversionTrackerService.get.
//
// campaign.selectiveOptimization = new SelectiveOptimization();
// campaign.selectiveOptimization.conversionTypeIds =
//    new long[] { INSERT_CONVERSION_TYPE_ID_1_HERE, INSERT_CONVERSION_TYPE_ID_2_HERE };

// Optional: Set the campaign settings for Advanced location options.
GeoTargetTypeSetting geoSetting = new GeoTargetTypeSetting();
geoSetting.positiveGeoTargetType =
    GeoTargetTypeSettingPositiveGeoTargetType.LOCATION_OF_PRESENCE;
geoSetting.negativeGeoTargetType =
    GeoTargetTypeSettingNegativeGeoTargetType.DONT_CARE;

campaign.settings = new Setting[] { universalAppSetting, geoSetting };
    

Python

# Optimize this campaign for getting new users for your app.
universal_app_campaign_setting = universal_app_campaign['settings'][0]
universal_app_campaign_setting['universalAppBiddingStrategyGoalType'] = (
    'OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME')

# Optional: If you select the OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME goal type,
# then also specify your in-app conversion types so AdWords can focus your
# campaign on people who are most likely to complete the corresponding in-app
# actions.
#
# Conversions type IDs can be retrieved using ConversionTrackerService.get.
# universal_app_campaign['selectiveOptimization'] = {
#     'conversionTypeIds': [INSERT_CONVERSION_TYPE_ID(s)_HERE]
# }

# Optional: Set the campaign settings for Advanced location options.
universal_app_campaign['settings'].append({
    'xsi_type': 'GeoTargetTypeSetting',
    'positiveGeoTargetType': 'DONT_CARE',
    'negativeGeoTargetType': 'DONT_CARE'
})
    

PHP

// Optimize this campaign for getting new users for your app.
$universalAppSetting->universalAppBiddingStrategyGoalType =
    'OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME';

// If you select bidding strategy goal type as
// OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME, then you may specify a set of
// conversion types for in-app actions to optimize the campaign towards.
// Conversion type IDs can be retrieved using ConversionTrackerService.get.
//
// $campaign->selectiveOptimization = new SelectiveOptimization();
// $campaign->selectiveOptimization->conversionTypeIds = array(
//     INSERT_CONVERSION_TYPE_ID_1_HERE,
//     INSERT_CONVERSION_TYPE_ID_2_HERE
// );

// Optional: Set the campaign settings for Advanced location options.
$geoTargetTypeSetting = new GeoTargetTypeSetting();
$geoTargetTypeSetting->negativeGeoTargetType = 'LOCATION_OF_PRESENCE';
$campaign->settings = array($universalAppSetting, $geoTargetTypeSetting);
    

Perl

# Optimize this campaign for getting new users for your app.
$universalAppSetting->set_universalAppBiddingStrategyGoalType(
  "OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME");

# If you select the OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME goal type, then also
# specify your in-app conversion types so AdWords can focus your campaign on
# people who are most likely to complete the corresponding in-app actions.
# Conversion type IDs can be retrieved using ConversionTrackerService.get.

# my $selectiveOptimization =
# Google::Ads::AdWords::v201609::SelectiveOptimization->new({
#  conversionTypeIds =>
#    [INSERT_CONVERSION_TYPE_ID_1_HERE, INSERT_CONVERSION_TYPE_ID_2_HERE]
# });
# $campaign->set_selectiveOptimization($selectiveOptimization);

# Optional: Set the campaign settings for advanced location options.
my $geoSetting = Google::Ads::AdWords::v201609::GeoTargetTypeSetting->new({
  positiveGeoTargetType => "LOCATION_OF_PRESENCE",
  negativeGeoTargetType => "DONT_CARE"
});
    

Ruby

# Optimize this campaign for getting new users for your app.
universal_app_setting[:universal_app_bidding_strategy_goal_type] =
    'OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME'

# Optional: If you select OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME goal type,
# then also specify your in-app conversion types so AdWords can focus your
# campaign on people who are most likely to complete the corresponding in-app
# actions.
# Conversion type IDs can be retrieved using ConversionTrackerService.get.
#
# universal_app_campaign[:selective_optimization] = {
#   :conversion_type_ids => [INSERT_CONVERSION_TYPE_ID(s)_HERE]
# }

# Optional: Set the campaign settings for Advanced location options.
geo_setting = {
  :xsi_type => 'GeoTargetTypeSetting',
  :positive_geo_target_type => 'DONT_CARE',
  :negative_geo_target_type => 'DONT_CARE'
}

universal_app_campaign[:settings] = [
  universal_app_setting,
  geo_setting
]
    

最后,使用 CampaignService.mutate 方法制作广告系列:

Java

// Create the operation.
CampaignOperation operation = new CampaignOperation();
operation.setOperand(campaign);
operation.setOperator(Operator.ADD);

CampaignOperation[] operations = new CampaignOperation[] {operation};

// Add the campaign.
CampaignReturnValue result = campaignService.mutate(operations);

// Display the results.
for (Campaign newCampaign : result.getValue()) {
  System.out.printf(
      "Universal app campaign with name '%s' and ID %d was added.%n",
      newCampaign.getName(), newCampaign.getId());

  // Optional: Set the campaign's location and language targeting. No other targeting
  // criteria can be used for universal app campaigns.
  setCampaignTargetingCriteria(newCampaign, adWordsServices, session);
}
    

.NET

// Create the operation.
CampaignOperation operation = new CampaignOperation();
operation.@operator = Operator.ADD;
operation.operand = campaign;

try {
  // Add the campaign.
  CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] { operation });

  // Display the results.
  if (retVal != null && retVal.value != null && retVal.value.Length > 0) {
    foreach (Campaign newCampaign in retVal.value) {
      Console.WriteLine("Universal app campaign with name = '{0}' and id = '{1}' was added.",
          newCampaign.name, newCampaign.id);

      // Optional: Set the campaign's location and language targeting. No other targeting
      // criteria can be used for universal app campaigns.
      SetCampaignTargetingCriteria(user, newCampaign);
    }
  } else {
    Console.WriteLine("No universal app campaigns were added.");
  }
} catch (Exception e) {
  throw new System.ApplicationException("Failed to add universal app campaigns.", e);
}
    

Python

# Construct operations and add campaigns.
operations = [{
    'operator': 'ADD',
    'operand': universal_app_campaign
}]

campaigns = campaign_service.mutate(operations)['value']
    

PHP

// Create the campaign operation.
$operations = array();
$operation = new CampaignOperation();
$operation->operand = $campaign;
$operation->operator = 'ADD';
$operations[] = $operation;

// Add campaigns on the server.
$result = $campaignService->mutate($operations);

// Print information for each campaign.
foreach ($result->value as $campaign) {
  printf("Universal App Campaign with name '%s' and ID %d was added.\n",
      $campaign->name, $campaign->id);
  // Optional: Set the campaign's location and language targeting. No other
  // targeting criteria can be used for Universal App campaigns.
  SetCampaignTargetingCriteria($campaign->id, $user);
}
    

Perl

# Create operation.
my $campaign_operation =
  Google::Ads::AdWords::v201609::CampaignOperation->new({
    operator => "ADD",
    operand  => $campaign
  });

# Add campaigns.
my $result =
  $client->CampaignService()->mutate({operations => [$campaign_operation]});

# Display campaigns.
foreach my $new_campaign (@{$result->get_value()}) {
  printf "Universal app campaign with name \"%s\" and ID %s was added.\n",
    $new_campaign->get_name(), $new_campaign->get_id();
  # Optional: Set the campaign's location and language targeting. No other
  # targeting criteria can be used for universal app campaigns.
  set_campaign_targeting_criteria($client, $new_campaign->get_id());
}
    

Ruby

  # Construct the operation and add the campaign.
  operations = [{
    :operator => 'ADD',
    :operand => universal_app_campaign
  }]

  campaigns = campaign_srv.mutate(operations)[:value]

  if campaigns
    campaigns.each do |campaign|
      puts "Universal app campaign with name '%s' and ID %d was added." %
          [campaign[:name], campaign[:id]]
      set_campaign_targeting_criteria(adwords, campaign)
    end
  else
    raise new StandardError, 'No universal app campaigns were added.'
  end
end

def set_campaign_targeting_criteria(adwords, campaign)
  campaign_criterion_service =
      adwords.service(:CampaignCriterionService, API_VERSION)

  criteria = [
    {
      :xsi_type => 'Location',
      :id => 21137 # California
    },
    {
      :xsi_type => 'Location',
      :id => 2484 # Mexico
    },
    {
      :xsi_type => 'Language',
      :id => 1000 # English
    },
    {
      :xsi_type => 'Language',
      :id => 1003 # Spanish
    }
  ]

  operations = criteria.map do |criterion|
    {
      :operator => 'ADD',
      :operand => {
        :campaign_id => campaign[:id],
        :criterion => criterion
      }
    }
  end

  response = campaign_criterion_service.mutate(operations)

  if response and response[:value]
    # Display the added campaign targets.
    response[:value].each do |criterion|
      puts 'Campaign criteria of type "%s" and id %d was added.' % [
          criterion[:criterion][:criterion_type],
          criterion[:criterion][:id]
      ]
    end
  end
end

if __FILE__ == $0
  API_VERSION = :v201609

  begin
    add_universal_app_campaigns()

  # Authorization error.
  rescue AdsCommon::Errors::OAuth2VerificationRequired => e
    puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
        "OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
        "to retrieve and store OAuth2 tokens."
    puts "See this wiki page for more details:\n\n  " +
        'https://github.com/googleads/google-api-ads-ruby/wiki/OAuth2'

  # HTTP errors.
  rescue AdsCommon::Errors::HttpError => e
    puts "HTTP Error: %s" % e

  # API errors.
  rescue AdwordsApi::Errors::ApiException => e
    puts "Message: %s" % e.message
    puts 'Errors:'
    e.errors.each_with_index do |error, index|
      puts "\tError [%d]:" % (index + 1)
      error.each do |field, value|
        puts "\t\t%s: %s" % [field, value]
      end
    end
  end
end

    

上传媒体

您最多可以为一个通用应用广告系列指定 10 个图片素材资源。AdWords 将使用这些素材资源来制作广告。您可以使用 MediaService.upload 方法上传图片。

Java

MediaServiceInterface mediaService =
    adWordsServices.get(session, MediaServiceInterface.class);

// Create image.
Image image = new Image();
image.setData(
    com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl("http://goo.gl/HJM3L"));
image.setType(MediaMediaType.IMAGE);

Media[] media = new Media[] {image};

// Upload image.
Media[] result = mediaService.upload(media);
    

.NET

MediaService mediaService = (MediaService) user.GetService(
    AdWordsService.v201609.MediaService);

// Create the image.
Image image = new Image();
image.data = MediaUtilities.GetAssetDataFromUrl("http://goo.gl/HJM3L");
image.type = MediaMediaType.IMAGE;

try {
  // Upload the image.
  Media[] result = mediaService.upload(new Media[] {image});
    

Python

media_service = client.GetService('MediaService', version='v201609')

with open(image_filename, 'r') as image_handle:
  image_data = base64.encodestring(image_handle.read())

# Construct media and upload image.
media = [{
    'xsi_type': 'Image',
    'data': image_data,
    'type': 'IMAGE'
}]
media = media_service.upload(media)[0]
    

PHP

$mediaService = $user->GetService('MediaService', ADWORDS_VERSION);

// Create image.
$image = new Image();
$image->data = MediaUtils::GetBase64Data('http://goo.gl/HJM3L');
$image->type = 'IMAGE';

// Make the upload request.
$result = $mediaService->upload(array($image));
    

Perl

# Create image.
my $image_data = Google::Ads::Common::MediaUtils::get_base64_data_from_url(
  "http://goo.gl/HJM3L");
my $image = Google::Ads::AdWords::v201609::Image->new({
    data => $image_data,
    type => "IMAGE"
  }
);

# Upload image.
$image = $client->MediaService()->upload({media => [$image]});
    

Ruby

media_srv = adwords.service(:MediaService, API_VERSION)

# Create image.
image_url =
    'http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg'
# This utility method retrieves the contents of a URL using all of the config
# options provided to the Api object.
image_data = AdsCommon::Http.get(image_url, adwords.config)
base64_image_data = Base64.encode64(image_data)
image = {
  # The 'xsi_type' field allows you to specify the xsi:type of the object
  # being created. It's only necessary when you must provide an explicit
  # type that the client library can't infer.
  :xsi_type => 'Image',
  :data => base64_image_data,
  :type => 'IMAGE'
}

# Upload image.
response = media_srv.upload([image])
    

使用 ListOperations

通用应用广告系列使用 ListOperations 设置 imageMediaIds 等列表字段。 ListOperations 描述列表中各元素的行为,并且总是与 API 对象中的某个列表一同进行定义(例如,imageMediaIdsOps 描述如何更新 imageMediaIds)。ListOperations 中操作符的数量必须等于相应列表中元素的数量。每个操作符都与相应的列表元素共同描述一项预期的更改。

假设 imageMediaIds 包含以下初始值:[1000, 1001, 1002]。下表列出了使用 ListOperations 更新 imageMediaIdsmutate 调用。

项目索引 图片媒体 ID ListOperation 含义
01003PUT添加项目 ID“1003”,因为原始列表中缺少该 ID。
11002REMOVE移除项目 ID“1002”。

执行完该 mutate 调用后,imageMediaIds 将包含以下值:[1000, 1001, 1003]

定位

通用应用广告系列仅支持两种形式的定位条件:广告系列一级的语言地理位置条件。默认情况下,此类广告系列定位到所有地理位置和所有语言。以下代码段将广告系列定位到加利福尼亚和墨西哥以及英语和西班牙语。

Java

// Get the CampaignCriterionService.
CampaignCriterionServiceInterface campaignCriterionService =
    adWordsServices.get(session, CampaignCriterionServiceInterface.class);

// Create locations. The IDs can be found in the documentation or
// retrieved with the LocationCriterionService.
Location california = new Location();
california.setId(21137L);

Location mexico = new Location();
mexico.setId(2484L);

// Create languages. The IDs can be found in the documentation or
// retrieved with the ConstantDataService.
Language english = new Language();
english.setId(1000L);

Language spanish = new Language();
spanish.setId(1003L);

List<Criterion> criteria = Lists.<Criterion>newArrayList(california, mexico, english, spanish);

// Create operations to add each of the criteria above.
List<CampaignCriterionOperation> operations = Lists.<CampaignCriterionOperation>newArrayList();
for (Criterion criterion : criteria) {
  CampaignCriterionOperation operation = new CampaignCriterionOperation();

  CampaignCriterion campaignCriterion = new CampaignCriterion();
  campaignCriterion.setCampaignId(campaign.getId());
  campaignCriterion.setCriterion(criterion);
  operation.setOperand(campaignCriterion);

  operation.setOperator(Operator.ADD);

  operations.add(operation);
}

// Set the campaign targets.
CampaignCriterionReturnValue returnValue =
    campaignCriterionService.mutate(
        operations.toArray(new CampaignCriterionOperation[operations.size()]));

if (returnValue != null && returnValue.getValue() != null) {
  // Display added campaign targets.
  for (CampaignCriterion campaignCriterion : returnValue.getValue()) {
    System.out.printf(
        "Campaign criteria of type '%s' and ID %d was added.%n",
        campaignCriterion.getCriterion().getCriterionType(),
        campaignCriterion.getCriterion().getId());
  }
}
    

.NET

// Get the CampaignCriterionService.
CampaignCriterionService campaignCriterionService =
  (CampaignCriterionService) user.GetService(
    AdWordsService.v201609.CampaignCriterionService);

// Create locations. The IDs can be found in the documentation or
// retrieved with the LocationCriterionService.
Location california = new Location() {
  id = 21137L
};

Location mexico = new Location() {
  id = 2484L
};

// Create languages. The IDs can be found in the documentation or
// retrieved with the ConstantDataService.
Language english = new Language() {
  id = 1000L
};

Language spanish = new Language() {
  id = 1003L
};

List<Criterion> criteria = new List<Criterion>() {
  california, mexico, english, spanish };

// Create operations to add each of the criteria above.
List<CampaignCriterionOperation> operations = new List<CampaignCriterionOperation>();
foreach (Criterion criterion in criteria) {
  CampaignCriterionOperation operation = new CampaignCriterionOperation() {
    operand = new CampaignCriterion() {
      campaignId = campaign.id,
      criterion = criterion
    },
    @operator = Operator.ADD
  };

  operations.Add(operation);
}

// Set the campaign targets.
CampaignCriterionReturnValue retVal = campaignCriterionService.mutate(operations.ToArray());

if (retVal != null && retVal.value != null) {
  // Display the added campaign targets.
  foreach (CampaignCriterion criterion in retVal.value) {
    Console.WriteLine("Campaign criteria of type '{0}' and id '{1}' was added.",
                      criterion.criterion.CriterionType, criterion.criterion.id);
  }
}
    

Python

campaign_criterion_service = client.GetService('CampaignCriterionService')

# Create locations. The IDs can be found in the documentation or retrieved
# with the LocationCriterionService.
criteria = [
    {
        'xsi_type': 'Location',
        'id': 21137  # California
    },
    {
        'xsi_type': 'Location',
        'id': 2484  # Mexico
    },
    {
        'xsi_type': 'Language',
        'id': 1000  # English
    },
    {
        'xsi_type': 'Language',
        'id': 1003  # Spanish
    }
]

operations = [{
    'operator': 'ADD',
    'operand': {
        'campaignId': campaign['id'],
        'criterion': criterion
    }
} for criterion in criteria]

response = campaign_criterion_service.mutate(operations)

if response and 'value' in response:
  # Display the added campaign targets.
  for criterion in response['value']:
    print ('Campaign criteria of type "%s" and id "%s" was added.'
           % (criterion['criterion']['type'],
              criterion['criterion']['id']))
    

PHP

// Get the service, which loads the required classes.
$campaignCriterionService =
    $user->GetService('CampaignCriterionService', ADWORDS_VERSION);

$campaignCriteria = array();
// Create locations. The IDs can be found in the documentation or retrieved
// with the LocationCriterionService.
$california = new Location();
$california->id = 21137;
$campaignCriteria[] = new CampaignCriterion($campaignId, null, $california);

$mexico = new Location();
$mexico->id = 2484;
$campaignCriteria[] = new CampaignCriterion($campaignId, null, $mexico);

// Create languages. The IDs can be found in the documentation or retrieved
// with the ConstantDataService.
$english = new Language();
$english->id = 1000;
$campaignCriteria[] = new CampaignCriterion($campaignId, null, $english);

$spanish = new Language();
$spanish->id = 1003;
$campaignCriteria[] = new CampaignCriterion($campaignId, null, $spanish);

// Create operations to add each of the criteria above.
$operations = array();
foreach ($campaignCriteria as $campaignCriterion) {
  $operations[] = new CampaignCriterionOperation($campaignCriterion, 'ADD');
}

// Set the campaign targets.
$result = $campaignCriterionService->mutate($operations);

// Display added campaign targets.
foreach ($result->value as $campaignCriterion) {
  printf("Campaign criterion of type '%s' and ID %d was added.\n",
      $campaignCriterion->criterion->CriterionType,
      $campaignCriterion->criterion->id
  );
}
    

Perl

# Create locations. The IDs can be found in the documentation or retrieved
# with the LocationCriterionService.
my $california = Google::Ads::AdWords::v201609::Location->new({id => 21137});
push @criteria, $california;
my $mexico = Google::Ads::AdWords::v201609::Location->new({id => 2484});
push @criteria, $mexico;

# Create languages. The IDs can be found in the documentation or retrieved
# with the ConstantDataService.
my $english = Google::Ads::AdWords::v201609::Language->new({id => 1000});
push @criteria, $english;
my $spanish = Google::Ads::AdWords::v201609::Language->new({id => 1003});
push @criteria, $spanish;

# Create operations.
my @operations = ();
foreach my $criterion (@criteria) {
  my $operation =
    Google::Ads::AdWords::v201609::CampaignCriterionOperation->new({
      operator => "ADD",
      operand  => Google::Ads::AdWords::v201609::CampaignCriterion->new({
          campaignId => $campaign_id,
          criterion  => $criterion
        })});
  push @operations, $operation;
}

# Set campaign criteria.
my $result =
  $client->CampaignCriterionService()->mutate({operations => \@operations});

# Display campaign criteria.
if ($result->get_value()) {
  foreach my $campaign_criterion (@{$result->get_value()}) {
    printf "Campaign criterion of type '%s' and ID %s was added.\n",
      $campaign_criterion->get_criterion()->get_type(),
      $campaign_criterion->get_criterion()->get_id();
  }
}
    

Ruby

campaign_criterion_service =
    adwords.service(:CampaignCriterionService, API_VERSION)

criteria = [
  {
    :xsi_type => 'Location',
    :id => 21137 # California
  },
  {
    :xsi_type => 'Location',
    :id => 2484 # Mexico
  },
  {
    :xsi_type => 'Language',
    :id => 1000 # English
  },
  {
    :xsi_type => 'Language',
    :id => 1003 # Spanish
  }
]

operations = criteria.map do |criterion|
  {
    :operator => 'ADD',
    :operand => {
      :campaign_id => campaign[:id],
      :criterion => criterion
    }
  }
end

response = campaign_criterion_service.mutate(operations)

if response and response[:value]
  # Display the added campaign targets.
  response[:value].each do |criterion|
    puts 'Campaign criteria of type "%s" and id %d was added.' % [
        criterion[:criterion][:criterion_type],
        criterion[:criterion][:id]
    ]
  end
end
    

报告

通用应用广告系列统计数据可在广告系列效果报告中进行查看;您可以按广告系列的 advertisingChannelTypeadvertisingChannelSubType 进行过滤,具体方法如下:

string query = "Select CampaignId, CampaignName, Clicks,
   Impressions, Cost from CAMPAIGN_PERFORMANCE_REPORT where
   AdvertisingChannelType = MULTI_CHANNEL and
   AdvertisingChannelSubType = UNIVERSAL_APP_CAMPAIGN during
   LAST_7_DAYS";

string fileName = ExampleUtilities.GetHomeDir() + Path.DirectorySeparatorChar +
    "CampaignPerformanceReport.gz";

ReportUtilities utilities = new ReportUtilities(user, "v201609", query,
    DownloadFormat.GZIPPED_CSV.ToString());
utilities.GetResponse().Save(fileName);

您也可以通过以下报告获取统计数据:

  • BUDGET_PERFORMANCE_REPORT
  • CAMPAIGN_LOCATION_TARGET_REPORT
  • CAMPAIGN_NEGATIVE_LOCATIONS_REPORT
  • ACCOUNT_PERFORMANCE_REPORT

代码示例

每个客户端库中都提供了添加通用应用广告系列的完整代码示例:

AdWords 移动应用安装广告系列是一种为了吸引更多用户下载移动应用而进行优化的广告系列子类型。

本部分将介绍如何使用 AdWords API 制作移动应用安装广告系列、制作移动应用广告以及监控这种广告系列的效果。

创建广告系列预算

要制作广告系列,首先必须设置预算。您可以使用 BudgetService 创建预算,或者选择现有的共享预算。以下代码段展示了如何创建采用标准投放方式、金额为每天 5 元的预算:

// Get the BudgetService.
BudgetService budgetService =
    (BudgetService) user.GetService(AdWordsService.v201609.BudgetService);

// Create the campaign budget.
Budget budget = new Budget();
budget.name = "My App Budget 1";
budget.deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD;
budget.amount = new Money();
budget.amount.microAmount = 5000000;

// Create the operation.
BudgetOperation budgetOperation = new BudgetOperation();
budgetOperation.@operator = Operator.ADD;
budgetOperation.operand = budget;

// Add the budget.
BudgetReturnValue budgetRetval = budgetService.mutate(
    new BudgetOperation[] {budgetOperation});
budget = budgetRetval.value[0];

制作广告系列

创建预算之后,您就可以使用 CampaignService 制作移动应用安装广告系列了。

不过,您必须先选择广告网络和出价策略,以确定广告系列将覆盖哪些受众群体。

选择广告网络

  • 对于搜索网络,当用户搜索与您的应用类似的应用,或者尝试执行通过您的应用可以更轻松完成的某些任务时,您可以向他们展示应用安装广告。
  • 展示广告网络中,您可以吸引那些所使用的应用与您的应用类似的用户。这类广告系列常常能获得大量展示,从而提升您应用的认知度,并吸引那些并未主动搜索您应用的新用户。

在 AdWords 网页界面中,您可以在广告系列一级(在设置中)指定应用,从而不必在每次制作新广告时都指定应用。在 API 中没有类似设置:您需要为您制作的每个应用安装广告指定应用 ID。有关详情,请参阅下面的制作广告

选择出价策略

搜索网络中,移动应用安装广告系列支持以下出价策略:

展示广告网络支持以下出价策略:

系统自动将 Google Play 中的 Android 应用安装作为转化来跟踪。因此,我们建议采用目标每次转化费用作为出价策略。您可以根据应用的每次安装费用来设置目标每次转化费用出价,系统会优化您的出价,帮您获取尽可能多的下载。您还可以针对广告组或个别定位条件,设置具体的出价。

以下代码段展示了如何制作面向展示广告网络的应用安装广告系列:

// Get the CampaignService.
CampaignService campaignService =
     (CampaignService) user.GetService(AdWordsService.v201609.CampaignService);

Campaign campaign = new Campaign();
campaign.advertisingChannelType = AdvertisingChannelType.DISPLAY;
// Recommendation: Set the campaign to PAUSED when creating it to stop
// the ads from immediately serving. Set to ENABLED once you've added
// targeting and the ads are ready to serve.
campaign.status = CampaignStatus.PAUSED;

// Set the advertising channel subtype for mobile app install campaigns.
campaign.advertisingChannelSubType = AdvertisingChannelSubType.DISPLAY_MOBILE_APP;

campaign.name = "My App campaign 1";

BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
biddingConfig.biddingStrategyType = BiddingStrategyType.TARGET_CPA;

// Specify a BiddingScheme with a target CPA.
TargetCpaBiddingScheme biddingScheme =  new TargetCpaBiddingScheme();
biddingScheme.targetCpa = new Money();
biddingScheme.targetCpa.microAmount = 1000000;
biddingConfig.biddingScheme = biddingScheme;
campaign.biddingStrategyConfiguration = biddingConfig;

// Use the ID of the Budget created in the previous step. You can also
// reuse an existing budget.
campaign.budget = new Budget();
campaign.budget.budgetId = budget.budgetId;

// Optional: Set the campaign ad serving optimization status.
campaign.adServingOptimizationStatus = AdServingOptimizationStatus.ROTATE;

// Create the operation.
CampaignOperation operation = new CampaignOperation();
operation.@operator = Operator.ADD;
operation.operand = campaign;

// Add the campaign.
CampaignReturnValue campaignRetVal = campaignService.mutate(new CampaignOperation[] {operation});

Campaign newCampaign = retVal.value[0];

制作面向搜索网络的广告系列所用步骤也大致相同。主要区别在于,您必须为 advertisingChannelTypeadvertisingChannelSubTypenetworkSetting 字段设置不同的值:

campaign.advertisingChannelType = AdvertisingChannelType.SEARCH;
campaign.advertisingChannelSubType = AdvertisingChannelSubType.SEARCH_MOBILE_APP;

// Target the networks you want your ads to serve on.
campaign.networkSetting = new NetworkSetting();
campaign.networkSetting.targetGoogleSearch = true;
campaign.networkSetting.targetSearchNetwork = true;

制作广告组

您必须使用 AdGroupService 在广告系列中制作广告组。

这里要注意的重要设置是广告组的 biddingStrategyConfiguration,该设置指定了您愿意为广告的每次点击或转化支付的金额,具体取决于您在广告系列一级选择的出价策略。以下代码示例使用的出价策略是:每次转化费用为 10 元。

// Get the AdGroupService.
AdGroupService adGroupService =
    (AdGroupService) user.GetService(AdWordsService.v201609.AdGroupService);

// Create the ad group.
AdGroup adGroup = new AdGroup();
adGroup.name = "My Mobile adgroup 1";
adGroup.status = AdGroupStatus.ENABLED;
adGroup.campaignId = campaign.id;

// Set the ad group bids.
BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();

CpaBid cpaBid = new CpaBid();
cpaBid.bid = new Money();
cpaBid.bid.microAmount = 10000000;

biddingConfig.bids = new Bids[] {cpaBid};

adGroup.biddingStrategyConfiguration = biddingConfig;

// Optional: Set targeting restrictions.
// These settings only affect serving for the Display Network.
TargetingSetting targetingSetting = new TargetingSetting();

TargetingSettingDetail placementDetail = new TargetingSettingDetail();
placementDetail.criterionTypeGroup = CriterionTypeGroup.PLACEMENT;
placementDetail.targetAll = true;

targetingSetting.details = new TargetingSettingDetail[] {
    placementDetail};

adGroup.settings = new Setting[] {targetingSetting};

// Create the operation.
AdGroupOperation operation = new AdGroupOperation();
operation.@operator = Operator.ADD;
operation.operand = adGroup;

// Create the ad group.
AdGroupReturnValue adGroupRetVal = adGroupService.mutate(new AdGroupOperation[] {adGroup});
AdGroup newAdGroup = retVal.value[0];

制作广告

在设置完广告组后,您就可以在广告系列中制作应用安装广告(点击下载广告)了。为了方便下载,这些广告会链接到应用商店中您应用的页面。

可以使用以下广告格式制作应用安装广告:

  • 应用安装广告(点击下载广告)自动生成。我们使用您的应用图标和 Google Play 或 App Store 中用户对您应用的评价来制作此类广告。在搜索网络和展示广告网络中均可使用这种广告格式。

  • 应用安装图片广告通过上传图片并填写文字制作而成。利用这种广告格式,您可以选择富有吸引力的图片来制作自定义应用安装广告。这种广告格式仅适用于展示广告网络。

  • 应用安装视频广告是展示广告网络中的视频广告,使用您的 YouTube 帐号中的链接制作而成,或利用您应用中的图片、图标和评价自动生成。

可以使用 AdGroupAdService 制作点击下载广告:

AdGroupAdService adGroupAdService =
    (AdGroupAdService) user.GetService(AdWordsService.v201609.AdGroupAdService);

// Create the template ad.
TemplateAd clickToDownloadAppAd = new TemplateAd();

clickToDownloadAppAd.name = "Ad for demo game";
clickToDownloadAppAd.templateId = 353;
clickToDownloadAppAd.url =
    "http://play.google.com/store/apps/details?id=com.example.demogame123";
clickToDownloadAppAd.displayUrl = "play.google.com";

// Create the template elements for the ad. You can refer to
// https://developers.google.com/adwords/api/docs/appendix/templateads
// for the list of available template fields.
TemplateElementField headline = new TemplateElementField();
headline.name = "headline";
headline.fieldText = "Enjoy your drive in Mars";
headline.type = TemplateElementFieldType.TEXT;

TemplateElementField description1 = new TemplateElementField();
description1.name = "description1";
description1.fieldText = "Realistic physics simulation";
description1.type = TemplateElementFieldType.TEXT;

TemplateElementField description2 = new TemplateElementField();
description2.name = "description2";
description2.fieldText = "Race against players online";
description2.type = TemplateElementFieldType.TEXT;

TemplateElementField appId = new TemplateElementField();
appId.name = "appId";
appId.fieldText = "com.example.demogame";
appId.type = TemplateElementFieldType.TEXT;

TemplateElementField appStore = new TemplateElementField();
appStore.name = "appStore";
appStore.fieldText = "2";
appStore.type = TemplateElementFieldType.ENUM;

TemplateElement adData = new TemplateElement();
adData.uniqueName = "adData";
adData.fields = new TemplateElementField[] {headline, description1,
    description2, appId, appStore};

clickToDownloadAppAd.templateElements = new TemplateElement[] {adData};

// Create the adgroupad.
AdGroupAd clickToDownloadAppAdGroupAd = new AdGroupAd();
clickToDownloadAppAdGroupAd.adGroupId = adGroupId;
clickToDownloadAppAdGroupAd.ad = clickToDownloadAppAd;

// Create the operation.
AdGroupAdOperation operation = new AdGroupAdOperation();
operation.@operator = Operator.ADD;
operation.operand = clickToDownloadAppAdGroupAd;

// Create the ad.
AdGroupAdReturnValue adRetval = adGroupAdService.mutate(
    new AdGroupAdOperation[] {operation});
AdGroupAd newAd = retval.value[0];

您还可以通过 API 制作应用安装图片广告或视频广告。请在我们的模板广告文档中查看相关字段。

定位广告

制作完广告后,接下来就是通过添加定位条件来指定向哪些用户展示您的广告。对于搜索网络,您可以根据用户在 Google 搜索和 Google Play 上搜索类似应用时所使用的搜索字词来添加关键字。

您可以使用 AdGroupCriterionService 创建广告组条件。

以下代码段展示了如何将“android race game”添加为广告系列的关键字:

AdGroupCriterionService adGroupCriterionService =
    (AdGroupCriterionService) user.GetService(
        AdWordsService.v201609.AdGroupCriterionService);

// Create the keyword.
Keyword keyword = new Keyword();
keyword.text = "android race game";
keyword.matchType = KeywordMatchType.BROAD;

// Create the biddable ad group criterion.
BiddableAdGroupCriterion keywordCriterion = new BiddableAdGroupCriterion();
keywordCriterion.adGroupId = adGroupId;
keywordCriterion.criterion = keyword;

// Optional: Set the keyword final url.
keywordCriterion.finalUrls = new string[] {
    "http://play.google.com/store/apps/demogame123" };

// Create the operations.
AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
operation.@operator = Operator.ADD;
operation.operand = keywordCriterion;

// Create the keywords.
AdGroupCriterionReturnValue criteriaRetVal = adGroupCriterionService.mutate(
    new AdGroupCriterionOperation[] {operation});

展示广告网络提供了更多定位选项。您可以通过 AdGroupCriterionService 以相同的方式创建这些定位选项,但使用不同的条件类型。

移动应用类别

您可以指定要在其中展示您的广告的移动应用类别。例如,您可以将定位条件设置为涵盖特定类型的应用,例如“游戏”或“健康”。以下代码段展示了如何定位您的应用安装广告,以便在 Google Play 的“游戏”应用中展示广告。

MobileAppCategory category = new MobileAppCategory();
category.mobileAppCategoryId = 60008;

有关受支持的移动应用类别的完整列表,请参阅移动应用类别页

以前曾下载应用

广告受众群体可以为以前曾下载过您想要定位的类别下的其他应用的用户。对于此类定位,您可以选择仅向购买过指定类别中的某款应用或进行过应用内购买的用户展示广告。以下代码段展示了如何将您的应用安装广告定位为仅面向安装过“益智游戏”类别中至少一款付费应用的用户。

// Target paid users. The list of valid IDs for this criteria can be found on
// https://developers.google.com/adwords/api/docs/reference/latest/AdGroupCriterionService.AppPaymentModel
AppPaymentModel paymentModel = new AppPaymentModel();
paymentModel.id = 30;

// Create the biddable ad group criterion.
BiddableAdGroupCriterion paymentModelCriterion = new BiddableAdGroupCriterion();
paymentModelCriterion.adGroupId = adGroupId;
paymentModelCriterion.criterion = paymentModel;

// Target users interested in Puzzle Games. See
// https://developers.google.com/adwords/api/docs/appendix/mobileappcategories for the list
// of valid IDs.
CriterionUserInterest userInterest = new CriterionUserInterest();
userInterest.userInterestId = 87086;

// Create the biddable ad group criterion.
BiddableAdGroupCriterion userInterestCriterion = new BiddableAdGroupCriterion();
userInterestCriterion.adGroupId = adGroupId;
userInterestCriterion.criterion = userInterest;

// Create the operations.
AdGroupCriterionOperation operation1 = new AdGroupCriterionOperation();
operation1.@operator = Operator.ADD;
operation1.operand = paymentModelCriterion;

AdGroupCriterionOperation operation2 = new AdGroupCriterionOperation();
operation2.@operator = Operator.ADD;
operation2.operand = userInterestCriterion;

您可以通过 ConstantDataService 获取所有可用于定位的用户兴趣列表,如下所示:

CriterionUserInterest[] userInterests = constantDataService.getUserInterestCriterion(
    ConstantDataServiceUserInterestTaxonomyType.MOBILE_APP_INSTALL_USER);

也可以在移动应用类别页中查看这些值。

新移动设备

您可以将广告定位到最近激活手机且可能有兴趣添加新应用的用户。您可以在兴趣类别下选择此选项,然后选择设备已激活的天数(从 1 个星期到最多 3 个月)。

以下代码段展示了如何构建一个 CriterionUserInterest 条件,以定位到在过去 7 天内激活了新设备的用户。您可以在智能手机用户兴趣页中找到有效的用户兴趣 ID。

// Target users who activated a new device within the last 7 days. See
// https://developers.google.com/adwords/api/docs/appendix/smartphone-userinterest for the list
// of valid IDs.
CriterionUserInterest userInterest = new CriterionUserInterest();
userInterest.userInterestId = 85002;

// Create the biddable ad group criterion.
BiddableAdGroupCriterion userInterestCriterion = new BiddableAdGroupCriterion();
userInterestCriterion.adGroupId = adGroupId;
userInterestCriterion.criterion = userInterest;

userInterestCriterion.biddingStrategyConfiguration.bids = new Bids[] { cpcBid };

受众特征定位

您可以根据受众特征(例如受众群体的年龄或性别)来定位广告。以下代码段展示了如何定位到年龄在 18 岁到 24 岁之间的用户。

AgeRange ageRange = new AgeRange();
ageRange.ageRangeType = AgeRangeAgeRangeType.AGE_RANGE_18_24;

同样,您还可以通过添加性别条件来限制性别。

设备定位

默认情况下,广告会在未安装您应用的兼容设备上展示。如果您在展示广告网络上投放广告,可以将定位条件限制为针对特定设备、操作系统版本或运营商。设备定位通过 CampaignCriterionService 在广告系列一级指定。

以下代码段展示了如何将您的广告系列限制为仅针对 Android Jelly Bean 4.1 或更高版本展示:

// Create the OS version restriction.
OperatingSystemVersion osVersion = new OperatingSystemVersion();
osVersion.id = 630257; // Android 4.1 Jelly Bean

CampaignCriterion osVersionCriterion = new CampaignCriterion();
osVersionCriterion.campaignId = campaignId;
osVersionCriterion.criterion = osVersion;

CampaignCriterionOperation operation = new CampaignCriterionOperation();
operation.@operator = Operator.ADD;
operation.operand = osVersionCriterion;

CampaignCriterionReturnValue campaignCriterionRetVal = campaignCriterionService.mutate(
    new CampaignCriterionOperation[] { operation });

可以通过移动平台页ConstantDataService 获取受支持的移动操作系统版本列表。同样,您也可以按移动设备运营商条件进行限制。

设置自定义出价

在默认情况下,定位条件使用广告组一级的出价。不过,您也可以使用自己的自定义出价逻辑来设置条件一级的自定义出价。

要在投放到展示广告网络的广告系列中启用条件一级的自定义出价,您需要先在广告组一级启用该出价,方法是指定您想要为其启用自定义出价的维度。搜索网络广告系列不需要这一步。以下代码段将维度指定为 PLACEMENT,因此您就有了针对展示位置条件的自定义出价:

// Get the AdGroupService.
AdGroupService adGroupService = (AdGroupService) user.GetService(
    AdWordsService.v201609.AdGroupService);

// Create the ad group.
AdGroup adGroup = new AdGroup();

// Optional: Set the bidding group. This allows you to set absolute bids on
// this dimension. This setting only affects serving for the Display Network.
adGroup.contentBidCriterionTypeGroup = CriterionTypeGroup.PLACEMENT;
adGroup.id = adGroupId;

// Create the operation.
AdGroupOperation operation = new AdGroupOperation();
operation.@operator = Operator.SET;
operation.operand = adGroup;

// Update the ad group.
AdGroupReturnValue adGroupRetVal = adGroupService.mutate(
   new AdGroupOperation[] {operation});

接下来,您可以使用 AdGroupCriterionService 更新该条件的出价。

以下代码段针对某个展示位置设置了每次点击费用为 3 元的自定义出价:

// Get the AdGroupCriterionService
AdGroupCriterionService adGroupCriterionService =
    (AdGroupCriterionService) user.GetService(
         AdWordsService.v201609.AdGroupCriterionService);

// Since we are not updating any placement-specific fields, it is enough to
// create a criterion object.
Criterion criterion = new Criterion();
criterion.id = placementId;

// Create ad group criterion.
BiddableAdGroupCriterion biddableAdGroupCriterion =
    new BiddableAdGroupCriterion();
biddableAdGroupCriterion.adGroupId = adGroupId;
biddableAdGroupCriterion.criterion = criterion;

// Create the bids.
BiddingStrategyConfiguration biddingConfig =
     new BiddingStrategyConfiguration();

// You may use CpaBid instead of CpcBid if your campaign uses
// a cost-per-acquisition bidding strategy.
CpcBid cpcBid = new CpcBid();
cpcBid.bid = new Money();
cpcBid.bid.microAmount = 3000000;
biddingConfig.bids = new Bids[] {cpcBid};

biddableAdGroupCriterion.biddingStrategyConfiguration = biddingConfig;

// Create the operation.
AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
operation.@operator = Operator.SET;
operation.operand = biddableAdGroupCriterion;

// Update the placement.
AdGroupCriterionReturnValue agcRetVal = adGroupCriterionService.mutate(
    new AdGroupCriterionOperation[] {operation});

转化跟踪

设置了广告系列后,您需要跟踪它的效果。对于移动应用安装广告系列,我们将应用下载作为转化进行跟踪。与应用安装有关的应用转化有以下两种类型:

  1. 应用安装(Google Play 中):
  2. 应用安装(首次打开):
    • 适用于 Android 和 iOS 应用
    • appConversionTypeFIRST_OPEN(Android 应用)或 DOWNLOAD(iOS 应用)

此外,您还可以跟踪 Android 应用的应用内操作,此类转化的 appConversionTypeIN_APP_PURCHASE

要了解有关应用转化的更多信息,请参阅转化跟踪指南以及 AdWords 帮助中心里关于 AndroidiOS 应用转化跟踪的文章。

报告

您可以利用广告系列效果报告获取广告系列的转化统计数据。以下代码段展示了如何生成该报告:

string query = "SELECT CampaignId, Conversions, Cost, Impressions " +
    "from CAMPAIGN_PERFORMANCE_REPORT DURING LAST_7_DAYS";

string fileName = ExampleUtilities.GetHomeDir() + Path.DirectorySeparatorChar +
    "CampaignPerformanceReport.gz";

ReportUtilities utilities = new ReportUtilities(user, "v201609", query,
    DownloadFormat.GZIPPED_CSV.ToString());
utilities.GetResponse().Save(fileName);

要查看受支持的报告类型列表,请参阅“报告”页

v201603 开始,CAMPAIGN_PERFORMANCE_REPORT 会包含通用应用广告系列的统计数据。将过滤条件设置为 AdvertisingChannelType = MULTI_CHANNELAdvertisingChannelSubType = UNIVERSAL_APP_CAMPAIGN,即可找出这些广告系列,如下所示:

string query = "SELECT CampaignId, Conversions, Cost, Impressions " +
    "from CAMPAIGN_PERFORMANCE_REPORT where " +
    "AdvertisingChannelType = MULTI_CHANNEL and " +
    "AdvertisingChannelSubType = UNIVERSAL_APP_CAMPAIGN DURING LAST_7_DAYS";

ReportUtilities utilities = new ReportUtilities(user, "v201609", query,
    DownloadFormat.GZIPPED_CSV.ToString());
utilities.GetResponse().Save(fileName);

考虑转化延迟的影响

由于用户设备与 Google 或您可能使用的第三方跟踪服务之间的互动存在延迟,转化次数可能需要几天时间才会显示在报告中。在查看转化报告时,请注意过去 3 天的转化数据可能尚不完整。

代码示例

移动应用互动广告系列

移动应用互动广告系列专注于增加用户与应用的互动。这种广告系列子类型专门用于吸引安装了您应用的用户重新尝试该应用或打开该应用执行特定操作。

本部分将介绍如何使用 AdWords API 制作移动应用互动广告系列、制作移动应用广告以及监测这种广告系列的效果。

代码示例使用 C# 语言编写。下面还提供了其他语言的示例

创建广告系列预算

要制作广告系列,首先必须设置预算。您可以使用 BudgetService 创建预算,或者选择现有的共享预算。以下代码段展示了如何创建采用标准投放方式、金额为每天 5 元的预算:

// Get the BudgetService.
AdWordsUser user = new AdWordsUser();
BudgetService budgetService =
    (BudgetService) user.GetService(AdWordsService.v201609.BudgetService);

// Create the campaign budget.
Budget budget = new Budget();
budget.name = "My App Budget 1";
budget.deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD;
budget.amount = new Money();
budget.amount.microAmount = 500000;

BudgetOperation budgetOperation = new BudgetOperation();
budgetOperation.@operator = Operator.ADD;
budgetOperation.operand = budget;

BudgetReturnValue budgetRetval = budgetService.mutate(
    new BudgetOperation[] {budgetOperation});
budget = budgetRetval.value[0];

制作广告系列

创建预算之后,您就可以使用 CampaignService 制作移动应用互动广告系列了。

不过,在制作广告系列之前,您必须先选择广告网络和出价策略。

选择广告网络

通过选择广告网络,可以确定广告系列将覆盖哪些受众群体。

  • 搜索网络中,广告在已安装您应用的手机和平板电脑上的搜索结果中展示。
  • 展示广告网络中,广告在其他应用中专门向已安装您应用的用户展示。

无论是上述哪种情况,应用互动广告都会促使应用的当前用户与该应用进行互动。

选择出价策略

出价功能为您提供多种广告出价方式。在广告系列一级的 BiddingStrategyConfiguration 中,biddingStrategyType 指定了出价类型,biddingScheme 则包含出价策略元数据。

搜索网络出价

对于搜索网络,我们支持以下出价策略

描述性名称 API 出价策略类型 API 出价策略
尽可能争取更多点击次数(默认) TARGET_SPEND TargetSpendBiddingScheme
目标每次转化费用 TARGET_CPA TargetCpaBiddingScheme
目标广告支出回报率 TARGET_ROAS TargetRoasBiddingScheme
目标搜索页位置 PAGE_ONE_PROMOTED PageOnePromotedBiddingScheme
排名胜出率目标 TARGET_OUTRANK_SHARE TargetOutrankShareBiddingScheme
每次点击费用人工出价 MANUAL_CPC ManualCpcBiddingScheme
展示广告网络出价

对于展示广告网络,我们支持以下出价策略

描述性名称 API 出价策略类型 API 出价策略
关注点击(默认)- 使用每次点击费用的最高出价 MANUAL_CPC ManualCpcBiddingScheme
关注安装 - 使用每次转化费用出价 TARGET_CPA TargetCpaBiddingScheme

制作搜索网络广告系列

要制作搜索网络广告系列,请按下面所示,更改广告系列的 advertisingChannelTypenetworkSetting 字段。

NetworkSetting 定义广告系列将定位到的广告网络。将 targetGoogleSearchtargetSearchNetwork 选项设为 true 意味着广告将只在搜索网络上投放。

campaign.advertisingChannelType = AdvertisingChannelType.SEARCH;

campaign.networkSetting = new NetworkSetting();
campaign.networkSetting.targetGoogleSearch = true;
campaign.networkSetting.targetSearchNetwork = true;
campaign.networkSetting.targetContentNetwork = false;
campaign.networkSetting.targetPartnerSearchNetwork = false;

在 AdWords 网页界面中,您可以在广告系列一级(在设置中)指定应用,从而不必在每次制作新广告时都指定应用。在 API 中没有类似设置,您需要为每个您制作的应用互动广告指定应用 ID。

制作展示广告网络广告系列

对于展示广告网络,只有在广告系列报告了足够的转化数据之后,根据转化进行优化选项才可用。

以下代码段展示了如何制作面向展示广告网络的移动应用互动广告系列。要关注移动应用互动,请务必将广告系列的 advertisingChannelSubType 设置为 DISPLAY_MOBILE_APP

// Get the CampaignService.
AdWordsUser user = new AdWordsUser();
CampaignService campaignService =
     (CampaignService) user.GetService(AdWordsService.v201609.CampaignService);

Campaign campaign = new Campaign();
campaign.advertisingChannelType = AdvertisingChannelType.DISPLAY;
campaign.advertisingChannelSubType =
    AdvertisingChannelSubType.DISPLAY_MOBILE_APP;
// Recommendation: Set the campaign to PAUSED when creating it to stop
// the ads from immediately serving. Set to ENABLED once you've added
// targeting and the ads are ready to serve.
campaign.status = CampaignStatus.PAUSED;

campaign.name = "My App Engagement campaign 1";

BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
biddingConfig.biddingStrategyType = BiddingStrategyType.TARGET_CPA;

// Specify a BiddingScheme with a target CPA.
TargetCpaBiddingScheme biddingScheme =  new TargetCpaBiddingScheme();
biddingScheme.targetCpa = new Money();
biddingScheme.targetCpa.microAmount = 1000000;
biddingConfig.biddingScheme = biddingScheme;
campaign.biddingStrategyConfiguration = biddingConfig;

// Use the ID of the Budget created in the previous step. You can also
// reuse an existing budget.
campaign.budget = new Budget();
campaign.budget.budgetId = budget.budgetId;

// Optional: Set the campaign ad serving optimization status.
campaign.adServingOptimizationStatus =
    AdServingOptimizationStatus.CONVERSION_OPTIMIZE;

// Create the operation.
CampaignOperation operation = new CampaignOperation();
operation.@operator = Operator.ADD;
operation.operand = campaign;

// Add the campaign.
CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] {operation});

Campaign newCampaign = retVal.value[0];

制作广告组

可以使用 AdGroupService 为该广告系列中的广告设置 AdGroup

首先,制作广告组。

// Get the AdGroupService.
AdWordsUser user = new AdWordsUser();
AdGroupService adGroupService =
    (AdGroupService) user.GetService(AdWordsService.v201609.AdGroupService);

// Create the ad group.
AdGroup adGroup = new AdGroup();
adGroup.name = "My App Engagement adgroup 1";
adGroup.status = AdGroupStatus.ENABLED;
adGroup.campaignId = campaign.id;

现在可以设置广告组出价。广告组的 biddingStrategyConfiguration 指定了您愿意为广告的每次点击或转化支付的金额。 BiddingStrategyConfiguration 会继承在广告系列一级设置的出价策略。

// Set the ad group bids.
BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();

CpaBid cpaBid = new CpaBid();
cpaBid.bid = new Money();
cpaBid.bid.microAmount = 10000000;

biddingConfig.bids = new Bids[] {cpaBid};

adGroup.biddingStrategyConfiguration = biddingConfig;

以下几个示例说明了如何为面向展示广告网络的广告组设置定位条件限制。

// Optional: Set targeting restrictions.
// These settings only affect serving for the Display Network.
TargetingSetting targetingSetting = new TargetingSetting();

TargetingSettingDetail placementDetail = new TargetingSettingDetail();
placementDetail.criterionTypeGroup = CriterionTypeGroup.PLACEMENT;
placementDetail.targetAll = true;

targetingSetting.details = new TargetingSettingDetail[] {
    placementDetail};

adGroup.settings = new Setting[] {targetingSetting};

// Optional: Set the bidding group. This allows you to set absolute bids on
// this dimension. These settings only affect serving for the Display Network.
adGroup.contentBidCriterionTypeGroup =
CriterionTypeGroup.USER_INTEREST_AND_LIST;

// Create the operation.
AdGroupOperation operation = new AdGroupOperation();
operation.@operator = Operator.ADD;
operation.operand = adGroup;

// Create the ad group.
AdGroupReturnValue retVal = adGroupService.mutate(new AdGroupOperation[]
{adGroup});
AdGroup newAdGroup = retVal.value[0];

AdWords 不仅可以将展示广告网络中的应用安装广告投放到应用内的广告展示位置,还可以投放到移动网站上的广告展示位置。这就增加了广告的覆盖面,还不会超出您的目标每次安装费用。您可以通过 optimizerSetting 选择启用此功能:

ExplorerAutoOptimizerSetting optimizerSettings = new ExplorerAutoOptimizerSetting();
optimizerSetting.optin = true;

adGroup.settings = new Setting[] {optimizerSetting};

请注意,要让此设置生效,您需要在广告组中添加至少一个移动设备定位条件。

制作广告

制作了广告组后,您就可以制作应用互动广告了。您需要设置适当的定位条件,以使您的应用互动广告只展示给已经安装了您应用的用户。当用户点击您的广告时,该广告会打开相关应用,并将用户引导至您使用深层链接指定的应用内活动。

  • 在搜索网络中,您可以利用这些广告将用户引导至与他们在 Google 上所搜索内容联系最紧密的应用内区域。目前不支持搜索网络上的 iOS 应用互动广告。
  • 在展示广告网络上,您可以利用这些广告向用户展示宣传文字,促使他们执行特定类型的应用内操作,例如登记、购买或预订机票等。这些广告通过深层链接将用户引导至应用内的特定区域,或者直接启动应用让其恢复到最近状态。

应用互动广告需要将深层链接作为最终到达网址。但深层链接不会在制作广告时自动设置。对于搜索网络上的应用互动广告系列,系统会使用您的深层链接生成一个应用 URI,以确保您的广告与 Google 搜索兼容。要了解如何创建深层链接,请参阅以下指南:

设置了深层链接后,它们在最终到达应用网址中的表示方式应如下所示:

android-app://{package_id}/{scheme}/{rest_of_url}

ios-app://{app_id}/{scheme}/{rest_of_url}

例如,如果深层链接是 demogame://loadlevel?level=mars,对应的应用是 com.example.demogame,该深层链接在广告网址中的表示方式如下:

android-app://com.example.demogame/demogame/loadlevel?level=mars

要了解深层链接格式,请参阅以下指南:

以下代码段展示了如何使用 AdGroupAdService 制作应用互动广告。搜索广告系列的应用互动广告使用模板 453。展示广告系列的应用安装广告使用模板 445(用于文字广告)或 455(用于图片广告)。

AdWordsUser user = new AdWordsUser();
AdGroupAdService adGroupAdService =
    (AdGroupAdService) user.GetService(AdWordsService.v201609.AdGroupAdService);
    // Create the template ad.
TemplateAd appEngagementAd = new TemplateAd();

appEngagementAd.displayUrl = "play.google.com";

appEngagementAd.name = "Ad for demo game";
appEngagementAd.templateId = 445;

// Define the ad's URL. You can refer to
// https://developers.google.com/app-indexing/webmasters/server
// for the right formatting to use on Android.
// Refer to https://developers.google.com/app-indexing/ios/app
// for the right formatting to use on iOS.
// Only one URL is allowed in the finalAppUrls array.
appEngagementAd.finalAppUrls = new string[] {
    "android-app://com.example.demogame/demogame/loadlevel?level=mars" };

// Create the template elements for the ad. You can refer to
// https://developers.google.com/adwords/api/docs/appendix/templateads
// for the list of available template fields.
TemplateElementField headline = new TemplateElementField();
headline.name = "promoHeadline";
headline.fieldText = "New levels are available";
headline.type = TemplateElementFieldType.TEXT;

TemplateElementField description = new TemplateElementField();
description.name = "promoDescription";
description.fieldText = "Race against players online";
description.type = TemplateElementFieldType.TEXT;

TemplateElementField appId = new TemplateElementField();
appId.name = "appId";
appId.fieldText = "com.example.demogame";
appId.type = TemplateElementFieldType.TEXT;

TemplateElementField appStore = new TemplateElementField();
appStore.name = "appStore";
appStore.fieldText = "2";
appStore.type = TemplateElementFieldType.ENUM;

TemplateElementField callToActionOpen = new TemplateElementField();
callToActionOpen.name = "callToActionOpen";
callToActionOpen.fieldText = "Play Now";
callToActionOpen.type = TemplateElementFieldType.TEXT;

TemplateElementField layout = new TemplateElementField();
layout.name = "layout";
layout.fieldText = "dark";
layout.type = TemplateElementFieldType.ENUM;

TemplateElement adData = new TemplateElement();
adData.uniqueName = "adData";
adData.fields = new TemplateElementField[] {headline, description, appId,
    appStore, callToActionInstall, callToActionOpen, layout};

appEngagementAd.dimensions = new Dimensions() {
    width = 320,
    height = 480
};

appEngagementAd.templateElements = new TemplateElement[] {adData};

// Finally, we get to tie the ad to the AdGroup!
// An AdGroupAd is a container that ties an ad to an
// AdGroup in the AdWords API.
AdGroupAd appEngagementAdAppAdGroupAd = new AdGroupAd();
appEngagementAdAdGroupAd.adGroupId = adGroupId;
appEngagementAdAppAdGroupAd.ad = appEngagementAd;

 // Create the operation.
 AdGroupAdOperation operation = new AdGroupAdOperation();
 operation.@operator = Operator.ADD;
 operation.operand = appEngagementAdAppAdGroupAd;

// Send the command to create the ad.
// The command returns the successfully created ad.
AdGroupAdReturnValue retval = adGroupAdService.mutate(
    new AdGroupAdOperation[] {operation});
AdGroupAd newAd = retval.value[0];

您还可以通过 AdWords API 制作应用互动图片广告和应用再互动广告。要详细了解相关字段,请参阅模板广告文档页

创建用于定位的用户列表(展示广告网络的必需设置)

对于展示广告网络上的移动应用互动广告系列,您必须借助用户列表定位将广告系列仅定位到已安装您应用的用户。要针对已安装您应用的用户自动设置用户列表,请将您的 Google Play 帐号与 AdWords 帐号关联起来。这样就会自动创建一个用户列表,其中包含所有已安装您应用的用户。您也可以使用 AdwordsUserListService 在 AdWords 帐号中创建更精细的其他用户列表。定义用户列表后,就可以将各个广告组定位到某个用户列表。

定位广告

制作完广告后,您就可以添加定位条件来指定向哪些用户展示广告。

搜索网络定位(可选)

在搜索网络上,您可以根据用户在 Google 搜索上搜索类似应用功能时所使用的搜索字词来添加关键字。

可以使用 AdGroupCriterionService 创建广告组条件。以下代码段展示了如何将 mars race event 添加为广告系列的关键字,并通过最终到达网址在应用内加载赛车活动。

AdWordsUser user = new AdWordsUser();
AdGroupCriterionService adGroupCriterionService =
    (AdGroupCriterionService) user.GetService(
        AdWordsService.v201609.AdGroupCriterionService);

// Create the keyword.
Keyword keyword = new Keyword();
keyword.text = "mars race event";
keyword.matchType = KeywordMatchType.BROAD;

// Create the biddable ad group criterion.
BiddableAdGroupCriterion keywordCriterion = new BiddableAdGroupCriterion();
keywordCriterion.adGroupId = adGroupId;
keywordCriterion.criterion = keyword;

// Optional: Set the keyword final url.
keywordCriterion.finalAppUrls = new string[] {
    "android-app://com.example.demogame/loadevent/mars/megarace" };

// Create the operations.
AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
operation.@operator = Operator.ADD;
operation.operand = keywordCriterion;

// Create the keywords.
AdGroupCriterionReturnValue criteriaRetVal = adGroupCriterionService.mutate(
    new AdGroupCriterionOperation[] {operation});

展示广告网络定位(必需)

如果您的广告在展示广告网络上投放,您需要使用用户列表定位将广告定位到已安装您应用的用户。此定位条件可以通过 AdGroupCriterionService 以相同方式创建,但要使用 CriterionUserList 类型。

受众群体定位

要吸引应用的现有用户,可以针对这些用户创建再营销用户列表并将其用作定位条件。应用互动广告必须定位到应有的现有用户。

以下代码段展示了如何获取您在 AdWords 帐号中创建的用户列表。如果您已经关联 Google Play 帐号和 AdWords 帐号,则系统已经为您创建并填充了用户列表,您只需要定位到该列表即可。如果不是,请按照这些说明设置用户列表。

以下代码段展示了如何按名称获取现有的用户列表。

AdWordsUser user = new AdWordsUser();
AdwordsUserListService userListService =
    (AdwordsUserListService)
         user.GetService(AdWordsService.v201609.AdwordsUserListService);

Selector selector = new Selector() {
    fields = new string[] { "Id", "Name", "ListType"},
    predicates = new Predicate[] {
        new Predicate() {
            field = "Name",
            @operator = PredicateOperator.EQUALS,
            values = new string[] {"All users of Demo App (Google Play)"}
        }
    }
};

UserListPage page = userListService.get(selector);
UserList myUserList = page.values[0];

接下来,您可以利用 UserList 实例来修改定位设置或设置自定义出价。

设置自定义出价

在默认情况下,定位条件使用广告组一级的出价。不过,您也可以使用自己的自定义出价逻辑来设置条件一级的自定义出价。

展示广告网络自定义出价

要在投放到展示广告网络的广告系列中启用条件一级的自定义出价,您需要先在广告组一级启用该出价,方法是指定您想要为其启用自定义出价的维度。

以下代码段将维度指定为 PLACEMENT,因此您就有了针对展示位置条件的自定义出价:

// Get the AdGroupService.
AdWordsUser user = new AdWordsUser();
AdGroupService adGroupService = (AdGroupService) user.GetService(
    AdWordsService.v201609.AdGroupService);

// Create the ad group.
AdGroup adGroup = new AdGroup();

// Optional: Set the bidding group. This allows you to set absolute bids on
// this dimension. This setting only affects serving for the Display Network.
adGroup.contentBidCriterionTypeGroup = CriterionTypeGroup.PLACEMENT;
adGroup.id = adGroupId;

// Create the operation.
AdGroupOperation operation = new AdGroupOperation();
operation.@operator = Operator.SET;
operation.operand = adGroup;

// Update the ad group.
AdGroupReturnValue adGroupRetVal = adGroupService.mutate(
   new AdGroupOperation[] {operation});

接下来,您可以使用 AdGroupCriterionService 更新该条件的出价。以下代码段针对某个展示位置设置了每次转化费用为 6 元的自定义出价。

// Get the AdGroupCriterionService.
AdGroupCriterionService adGroupCriterionService =
    (AdGroupCriterionService) user.GetService(
         AdWordsService.v201609.AdGroupCriterionService);

// Since we are not updating any placement-specific fields, it is enough to
// create a criterion object. The placementId, in this case,
// is a pre-existing Placement targeting a website.
Criterion criterion = new Criterion();
criterion.id = placementId;

// Create ad group criterion.
BiddableAdGroupCriterion biddableAdGroupCriterion =
    new BiddableAdGroupCriterion();
biddableAdGroupCriterion.adGroupId = adGroupId;
biddableAdGroupCriterion.criterion = criterion;

// Create the bids.
BiddingStrategyConfiguration biddingConfig =
     new BiddingStrategyConfiguration();
CpaBid cpcBid = new CpaBid();
cpaBid.bid = new Money();
cpaBid.bid.microAmount = 6000000;
biddingConfig.bids = new Bids[] {cpaBid};

biddableAdGroupCriterion.biddingStrategyConfiguration = biddingConfig;

// Create the operation.
AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
operation.@operator = Operator.SET;
operation.operand = biddableAdGroupCriterion;

// Update the placement.
AdGroupCriterionReturnValue agcRetVal = adGroupCriterionService.mutate(
    new AdGroupCriterionOperation[] {operation});

跟踪广告系列的效果

设置了广告系列后,您需要跟踪它的效果。AdWords API 支持多种报告类型,您可以使用这些报告跟踪广告系列的效果。

以下代码段展示了如何生成广告系列效果报告来跟踪广告系列的效果:

string query = "SELECT CampaignId, Conversions, Cost, Impressions from
CAMPAIGN_PERFORMANCE_REPORT DURING LAST_7_DAYS";

string filePath = ExampleUtilities.GetHomeDir() + Path.DirectorySeparatorChar
    + "CampaignPerformanceReport.gz";

ReportUtilities utilities = new ReportUtilities(user, "v201609", query,
    DownloadFormat.GZIPPED_CSV.ToString());
utilities.GetResponse().Save(fileName);

要衡量用户与应用的互动情况,您需要设置应用内转化。请按照设置转化跟踪中的说明为应用内转化创建转化跟踪代码。要了解如何将应用内的用户互动作为转化来跟踪,请参阅应用转化跟踪中的说明。

代码示例

发送以下问题的反馈:

此网页
AdWords API
AdWords API
需要帮助?请访问我们的支持页面