否定关键字、排除的展示位置与共享集

否定关键字可防止广告在不相关的搜索结果中展示。然而,如果您的否定关键字列表中存在不正确的匹配类型,则可能会在不经意间阻止正常的关键字匹配,削弱广告系列的成效。

排除的展示位置可以避免广告在以下位置展示:特定类型的内容旁边;特定的网站、移动应用、YouTube 视频,或者展示广告网络中的 YouTube 频道中。

本指南将介绍如何完成以下操作:

  • 使用 AdWords API 自动消除冲突的否定关键字。
  • 使用共享集管理否定关键字和排除的展示位置。
  • 在您帐号中的所有广告系列内,使用排除的客户条件排除具体的展示位置。

场景

假设您拥有一家男装店,并希望针对男士配饰投放一个特殊的冬季假日广告系列,以增加网站的流量。您最近运行了搜索字词报告,且注意到,当用户搜索女士真丝围巾时,也会看到您广告系列中的男士配饰广告。

您的关键字列表中有“真丝领带”、“羊毛围巾”和“男士礼品”等广泛匹配关键字。您希望将“真丝围巾”添加为否定关键字,但应该选择哪种否定关键字匹配类型

下表列出了一些搜索字词,并说明对于这三个否定匹配类型中的每一个,广告是否会被阻止投放。

搜索字词 否定关键字
-silk scarves
(否定广泛匹配)
-"silk scarves"
(否定词组匹配)
-[silk scarves]
(否定完全匹配)
男士围巾
男士领带
围巾真丝 圆圈斜杠符号
真丝领带
真丝礼品围巾 圆圈斜杠符号
真丝围巾 圆圈斜杠符号 圆圈斜杠符号 圆圈斜杠符号
真丝围巾礼品 圆圈斜杠符号 圆圈斜杠符号
真丝领带羊毛围巾 圆圈斜杠符号
女士真丝围巾 圆圈斜杠符号 圆圈斜杠符号
羊毛围巾

请注意,广泛匹配否定关键字-真丝围巾会阻止某些有效的搜索字词,如“真丝领带羊毛围巾”。

确定大规模冲突的否定关键字

如果只有几个关键字,那么很容易就能判断哪些否定关键字与肯定关键字冲突。而如果您的帐号中有数以千计的关键字和数以百计的否定关键字,这一过程就要困难得多。让我们来看看如何使用 AdWords API 实现这个过程的自动化。

为了方便演示,我们将这一场景限制为肯定关键字是在广告组级别,否定关键字是在广告系列级别。

获取否定关键字

如下所示,通过运行广告系列否定关键字效果报告,获取广告系列级否定关键字列表:

def retrieve_negative_keywords(report_utils)
  report_definition = {
    :selector => {
      :fields => ['CampaignId', 'Id', 'KeywordMatchType', 'KeywordText']
    },
    :report_name => 'Negative campaign keywords',
    :report_type => 'CAMPAIGN_NEGATIVE_KEYWORDS_PERFORMANCE_REPORT',
    :download_format => 'CSV',
    :date_range_type => 'TODAY',
    :include_zero_impressions => true
  }

  campaigns = {}

  report = report_utils.download_report(report_definition)
  # Slice off the first row (report name).
  report.slice!(0..report.index("\n"))

  CSV.parse(report, { :headers => true }) do |row|
    campaign_id = row['Campaign ID']

    # Ignore totals row.
    if row[0] != 'Total'
      campaigns[campaign_id] ||= Campaign.new(campaign_id)
      negative = Negative.from_csv_row(row)
      campaigns[campaign_id].negatives << negative
    end
  end

  return campaigns
end

获取肯定关键字

运行关键字效果报告,获取肯定关键字列表。allowed_values 参数允许您按状态来滤除广告系列、广告组和关键字,且可接受值 PAUSEDREMOVED

def retrieve_positive_keyword_report(report_utils, allowed_values)
  report_definition = {
    :selector => {
      :fields => ['CampaignId', 'CampaignName', 'AdGroupId', 'Id',
                  'KeywordMatchType', 'KeywordText'],
      :predicates => [
        {
          :field => 'CampaignStatus',
          :operator => 'IN',
          :values => allowed_values
        },
        {
          :field => 'AdGroupStatus',
          :operator => 'IN',
          :values => allowed_values
        },
        {
          :field => 'Status',
          :operator => 'IN',
          :values => allowed_values
        },
        {
          :field => 'IsNegative',
          :operator => 'IN',
          :values => ['false']
        }
      ]
    },
    :report_name => 'Ad group keywords',
    :report_type => 'KEYWORDS_PERFORMANCE_REPORT',
    :download_format => 'CSV',
    :date_range_type => 'TODAY',
    :include_zero_impressions => true
  }

  report = report_utils.download_report(report_definition)
  # Slice off the first row (report name).
  report.slice!(0..report.index("\n"))

  return report
end

确定冲突的否定关键字

否定关键字按照以下逻辑工作:

  • 比搜索字词更严格的否定关键字不会阻止搜索字词。例如,-[silk scarves] 不会阻止“红色丝绸围巾”。
  • 如果搜索字词包含广泛匹配否定关键字中的所有字词,则会被否定关键字阻止。例如,-真丝围巾将阻止“真丝礼品围巾”,而不会阻止“羊毛围巾”。
  • 如果搜索字词以一个单一短语的形式包含了词组匹配否定关键字中的所有字词,则会被该否定关键字阻止。例如,-"真丝围巾"将阻止“礼品真丝围巾”,而不会阻止“真丝礼品围巾”。
  • 而只有搜索字词与完全匹配否定关键字完全一致时,才会被阻止。例如,-[真丝围巾]将阻止“真丝围巾”,而不会阻止“红色真丝围巾”。
  • 关键字不区分大小写。
  • 紧密变体匹配不适用于否定关键字。例如,-silk scarves 不会阻止“silk scarf”,尽管该关键字是“silk scarves”的紧密变体匹配,也是如此。

以下方法是对这个逻辑的实现:

def compare_keywords(negatives, positive)
  negatives.each do |negative|
    match_type = negative.match_type.downcase
    negative_text = negative.text.downcase
    positive_text = positive.text.downcase

    match = false

    # If the negative keyword is more strict than the positive one, it cannot
    # match.
    # E.g. a negative exact "cool shoe" will not prevent positive phrase
    # "cool shoe shine".
    positive_match_type = positive.match_type.downcase
    next if positive_match_type == 'broad' && match_type != 'broad'
    next if positive_match_type == 'phrase' && match_type == 'exact'

    # Exact matching with negative keywords triggers only when the full text of
    # the keywords is exactly the same.
    # E.g. a negative "silk scarves" will only match "silk scarves", not
    # "red silk scarves".
    if match_type == 'exact'
      match = (negative_text == positive_text)
    end

    # Phrase matching with negative keywords triggers when the negative phrase
    # is present in the target, completely unmodified.
    # E.g. a negative "silk scarves" will match "gift silk scarves", but not
    # "silk gift scarves".
    if match_type == 'phrase'
      negative_tokens = negative_text.split(' ')
      positive_tokens = positive_text.split(' ')

      positive_tokens.each_with_index do |positive_token, positive_index|
        # Iterate until the current token matches the first token in the
        # negative keyword.
        if positive_token == negative_tokens.first
          candidate_match = true
          # Do all of the subsequent tokens also match?
          negative_tokens[1..-1].each_with_index do |token, index|
            if token != positive_tokens[positive_index + index + 1]
              candidate_match = false
              break
            end
          end

          match = candidate_match
        end
      end
    end

    # Broad matching with negative keywords triggers when all of the words are
    # present and exactly the same.
    # E.g. a negative "silk scarves" will match "silk gift scarves", but not
    # "wool scarves".
    if match_type == 'broad'
      negative_tokens = negative_text.split(' ')
      positive_tokens = positive_text.split(' ')

      candidate_match = true

      negative_tokens.each do |token|
        if !positive_tokens.include?(token)
          candidate_match = false
          break
        end
      end

      match = candidate_match
    end

    negative.add_blocked(positive) if match
  end
end

删除冲突的否定关键字

如果确定了冲突的否定关键字,您可以:

您应该定期重复此过程,以确保对关键字列表或否定关键字列表的任何更改都没有引入新的冲突。

完整示例代码

上面使用的完整示例代码AdWords API Ruby 客户端库的一部分。

共享集

如果有一组关键字或展示位置在多个广告系列中为您带来了不需要的展示或点击,您可以在 AdWords 中创建集中了这些否定关键字或排除的展示位置的列表,并将该列表添加到所有广告系列。该功能被称为共享集

有了共享集,您可以更高效地管理否定关键字和展示位置排除对象,不需要在帐号内复制实体。

v201710 中新增了对在经理帐号中创建共享集的支持。如果您使用的是旧版 AdWords API,可以在经理帐号中使用界面创建共享集,然后使用 AdWords API 管理其条件和广告系列关联。

共享集类型 帐号类型 SharedSetService SharedCriterionService CampaignSharedSetService
否定关键字 客户 复选标记 复选标记 复选标记
否定关键字 经理 从 v201710 开始 复选标记 复选标记
排除的展示位置 客户 复选标记 复选标记 复选标记
排除的展示位置 经理 圆圈斜杠符号 圆圈斜杠符号 圆圈斜杠符号

本节将介绍如何使用 AdWords API 来创建和使用共享集。相关示例侧重的是否定关键字。您可以使用类似的方法为客户帐号创建“排除的展示位置”共享集。

代码示例使用的是 AdWords API Java 库。我们还为其他支持的客户端库提供了代码示例。

创建共享集

要使用包含否定关键字的共享集,必须先创建一个共享集,然后填充要排除的关键字列表。

以下代码段会使用 SharedSetService 创建包含否定关键字的共享集。


// Create the operation.
SharedSetOperation operation = new SharedSetOperation();
operation.setOperator(Operator.ADD);

// Create the shared set.
SharedSet sharedSet = new SharedSet();
sharedSet.setName("API Negative keyword list for demo");

// Set the type of the shared set. This may be negative keywords or placements.
sharedSet.setType(SharedSetType.NEGATIVE_KEYWORDS);
operation.setOperand(sharedSet);

SharedSetReturnValue retval = sharedSetService.mutate(
    new SharedSetOperation[] {operation});
for (SharedSet set : retval.getValue()) {
  System.out.println("Shared set with id = " + set.getSharedSetId() + ", name = " +
      set.getName() + ", type = " + set.getType() + ", status = " + set.getStatus() +
      "was created.");
}

创建共享集之后,您可以使用 SharedCriterionService 将关键字添加到新创建的共享集。以下代码段会将两个新的关键字添加到共享集。

String[] keywordTexts = new String[] {"mars cruise", "mars hotels"};

List operations = new ArrayList();
for (String keywordText: keywordTexts) {
  // Create the shared criterion.
  Keyword keyword = new Keyword();
  keyword.setText(keywordText);
  keyword.setMatchType(KeywordMatchType.BROAD);

  SharedCriterion sharedCriterion = new SharedCriterion();
  sharedCriterion.setCriterion(keyword);
  sharedCriterion.setNegative(true);
  sharedCriterion.setSharedSetId(sharedSetId);

  SharedCriterionOperation operation = new SharedCriterionOperation();
  operation.setOperator(Operator.ADD);
  operation.setOperand(sharedCriterion);
  operations.add(operation);
}

SharedCriterionReturnValue retval = sharedCriterionService.mutate(operations.toArray(
    new SharedCriterionOperation[operations.size()]));
for (SharedCriterion sharedCriterion : retval.getValue()) {
  Keyword keyword = (Keyword) sharedCriterion.getCriterion();
  System.out.println("Added keyword with id = " + keyword.getId() + ", text = " +
      keyword.getText() + ", matchtype = " + keyword.getMatchType() + " to shared " +
      "set with id = " + sharedSetId + ".");
}

您可以使用 memberCount 字段来确定共享集中的关键字或展示位置的数量。另一个有用的字段是 referenceCount,它可以告诉您共享集与多少广告系列相关联。

将共享集应用于广告系列

创建共享集之后,可以使用 CampaignSharedSetService 将其附加到多个广告系列。以下代码演示了如何将现有的共享集附加到广告系列:

// Create the campaign shared set
CampaignSharedSet campaignSharedSet = new CampaignSharedSet();
campaignSharedSet.setCampaignId(campaignId);
campaignSharedSet.setSharedSetId(sharedSetId);

CampaignSharedSetOperation operation = new CampaignSharedSetOperation();
operation.setOperator(Operator.ADD);
operation.setOperand(campaignSharedSet);

CampaignSharedSetReturnValue retval = campaignSharedSetService.mutate(
    new CampaignSharedSetOperation[] {operation});
for (CampaignSharedSet attachedCampaignSharedSet : retval.value) {
  System.out.println("Attached shared set with id = " +
      attachedCampaignSharedSet.getSharedSetId() + " to campaign id " +
      attachedCampaignSharedSet.getCampaignId() + ".");
}

如下所示,您可以使用 CampaignSharedSetService.get() 方法获取已应用于现有广告系列的共享集。

// Create the selector.
Selector selector = new Selector();
selector.setFields(new String[] {"SharedSetId", "CampaignId", "SharedSetName",
   "SharedSetType", "Status"});

// Filter your results by specific campaign id.
Predicate predicate = new Predicate();
predicate.setField("CampaignId");
predicate.setOperator(PredicateOperator.EQUALS);
predicate.setValues(new String[] {campaignId.toString()});

// Filter your results by the type of shared set.
Predicate predicate1 = new Predicate();
predicate1.setField("SharedSetType");
predicate1.setOperator(PredicateOperator.IN);
predicate1.setValues(new String[] {"NEGATIVE_KEYWORDS", "NEGATIVE_PLACEMENTS"});

selector.setPredicates(new Predicate[] {predicate});

CampaignSharedSetPage page = campaignSharedSetService.get(selector);
if (page.getEntries() != null) {
  for (CampaignSharedSet campaignSharedSet : page.getEntries()) {
    System.out.println("Shared set with id = " + campaignSharedSet.getSharedSetId() +
        ", name = " + campaignSharedSet.getSharedSetName() + ", type = " +
        campaignSharedSet.getSharedSetType() + " and status = " +
        campaignSharedSet.getStatus() + " was found.");
    }
  }
}

报告

使用共享集报告获取共享集的报告数据。使用广告系列共享集报告获取广告系列共享集的报告数据。共享集条件报告提供共享集条件的可下载快照。

帐号级排除条件

从 v201710 版 AdWords API 开始,您可以使用 CustomerNegativeCriterionService 来在客户帐号内的所有广告系列中排除具体的展示广告网络条件。

本服务支持以下类型的排除条件:

添加帐号级排除条件的作用与共享集服务类似,主要区别如下:

  • 通过 CustomerNegativeCriterionService 创建的条件适用于您帐号中的所有广告系列。采用共享集方法时,则只会在与共享集关联的广告系列中排除相应的条件。

  • 在帐号级别排除某个条件只需一步:添加 CustomerNegativeCriterion。相比之下,使用共享集从特定广告系列中排除某个条件则涉及多个步骤:创建共享集,向共享集添加条件,然后将共享集与一个或多个广告系列相关联。

以下代码段展示了如何使帐号中的所有广告避免与某些类型的内容一起展示,或使它们不要在特定的网站上展示:

Java

// Get the CustomerNegativeCriterionService.
CustomerNegativeCriterionServiceInterface customerNegativeCriterionService =
    adWordsServices.get(session, CustomerNegativeCriterionServiceInterface.class);

List<Criterion> criteria = new ArrayList<>();

// Exclude tragedy & conflict content.
ContentLabel tragedyContentLabel = new ContentLabel();
tragedyContentLabel.setContentLabelType(ContentLabelType.TRAGEDY);
criteria.add(tragedyContentLabel);

// Exclude a specific placement.
Placement placement = new Placement();
placement.setUrl("http://www.example.com");
criteria.add(placement);

// Additional criteria types are available for this service. See the types listed
// under Criterion here:
// https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

// Create operations to add each of the criteria above.
List<CustomerNegativeCriterionOperation> operations = new ArrayList<>();
for (Criterion criterion : criteria) {
  CustomerNegativeCriterion negativeCriterion = new CustomerNegativeCriterion();
  negativeCriterion.setCriterion(criterion);
  CustomerNegativeCriterionOperation operation = new CustomerNegativeCriterionOperation();
  operation.setOperator(Operator.ADD);
  operation.setOperand(negativeCriterion);
  operations.add(operation);
}

// Send the request to add the criteria.
CustomerNegativeCriterionReturnValue result =
    customerNegativeCriterionService.mutate(
        operations.toArray(new CustomerNegativeCriterionOperation[operations.size()]));

// Display the results.
for (CustomerNegativeCriterion negativeCriterion : result.getValue()) {
  System.out.printf(
      "Customer negative criterion with criterion ID %d and type '%s' was added.%n",
      negativeCriterion.getCriterion().getId(),
      negativeCriterion.getCriterion().getCriterionType());
}

C#

using (CustomerNegativeCriterionService customerNegativeCriterionService =
    (CustomerNegativeCriterionService) user.GetService(
        AdWordsService.v201802.CustomerNegativeCriterionService)) {

  List<Criterion> criteria = new List<Criterion>();

  // Exclude tragedy & conflict content.
  ContentLabel tragedyContentLabel = new ContentLabel();
  tragedyContentLabel.contentLabelType = ContentLabelType.TRAGEDY;
  criteria.Add(tragedyContentLabel);

  // Exclude a specific placement.
  Placement placement = new Placement();
  placement.url = "http://www.example.com";
  criteria.Add(placement);

  // Additional criteria types are available for this service. See the types listed
  // under Criterion here:
  // https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

  // Create operations to add each of the criteria above.
  List<CustomerNegativeCriterionOperation> operations =
      new List<CustomerNegativeCriterionOperation>();
  foreach (Criterion criterion in criteria) {
    CustomerNegativeCriterion negativeCriterion = new CustomerNegativeCriterion();
    negativeCriterion.criterion = criterion;
    CustomerNegativeCriterionOperation operation = new CustomerNegativeCriterionOperation();
    operation.@operator = Operator.ADD;
    operation.operand = negativeCriterion;
    operations.Add(operation);
  }

  try {
    // Send the request to add the criteria.
    CustomerNegativeCriterionReturnValue result =
        customerNegativeCriterionService.mutate(operations.ToArray());

    // Display the results.
    foreach (CustomerNegativeCriterion negativeCriterion in result.value) {
      Console.WriteLine("Customer negative criterion with criterion ID {0} and type '{1}' " +
          "was added.", negativeCriterion.criterion.id,
          negativeCriterion.criterion.type);
    }
  } catch (Exception e) {
    throw new System.ApplicationException("Failed to set customer negative criteria.", e);
  }
}

Python

customer_negative_criterion_service = client.GetService(
    'CustomerNegativeCriterionService', version='v201802')

criteria = [
    # Exclude tragedy & conflict content.
    {
        'xsi_type': 'ContentLabel',
        'contentLabelType': 'TRAGEDY'
    },
    # Exclude a specific placement.
    {
        'xsi_type': 'Placement',
        'url': 'http://www.example.com'
    }
    # Additional criteria types are available for this service. See the types
    # listed under Criterion here:
    # https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion
]

# Create operations to add each of the criteria above.
operations = [{
    'operator': 'ADD',
    'operand': {
        'criterion': criterion
    }
} for criterion in criteria]

# Make the mutate request.
result = customer_negative_criterion_service.mutate(operations)

# Display the resulting campaign criteria.
for negative_criterion in result['value']:
  print ('Customer negative criterion with criterion ID "%s", and type "%s" '
         'was added.' % (negative_criterion['criterion']['id'],
                         negative_criterion['criterion']['type']))

PHP

$customerNegativeCriterionService = $adWordsServices->get(
    $session,
    CustomerNegativeCriterionService::class
);

$criteria = [];

// Exclude tragedy & conflict content.
$tragedyContentLabel = new ContentLabel();
$tragedyContentLabel->setContentLabelType(ContentLabelType::TRAGEDY);
$criteria[] = $tragedyContentLabel;

// Exclude a specific placement.
$placement = new Placement();
$placement->setUrl('http://www.example.com');
$criteria[] = $placement;

// Additional criteria types are available for this service. See the types
// listed under Criterion here:
// https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

// Create operations to add each of the criteria above.
$operations = [];
foreach ($criteria as $criterion) {
    $negativeCriterion = new CustomerNegativeCriterion();
    $negativeCriterion->setCriterion($criterion);
    $operation = new CustomerNegativeCriterionOperation();
    $operation->setOperator(Operator::ADD);
    $operation->setOperand($negativeCriterion);
    $operations[] = $operation;
}

// Add the criteria on the server and print out some information.
$result = $customerNegativeCriterionService->mutate($operations);
foreach ($result->getValue() as $negativeCriterion) {
    printf(
        "Customer negative criterion with criterion ID %d and type '%s' was added.\n",
        $negativeCriterion->getCriterion()->getId(),
        $negativeCriterion->getCriterion()->getType()
    );
}

Perl

# Get the CustomerNegativeCriterionService.
my @criteria = ();

# Exclude tragedy & conflict content.
my $tragedy_content_label = Google::Ads::AdWords::v201802::ContentLabel->new({
  contentLabelType => 'TRAGEDY'
});
push @criteria, $tragedy_content_label;

# Exclude a specific placement.
my $placement = Google::Ads::AdWords::v201802::Placement->new({
  url => 'http://www.example.com'
});
push @criteria, $placement;

# Additional criteria types are available for this service. See the types
# listed under Criterion here:
# https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

# Create operations to add each of the criteria above.
my @operations = ();
for my $criterion (@criteria) {
  my $negative_criterion =
    Google::Ads::AdWords::v201802::CustomerNegativeCriterion->new({
      criterion => $criterion
    });
  my $operation =
    Google::Ads::AdWords::v201802::CustomerNegativeCriterionOperation->new({
      operator => 'ADD',
      operand  => $negative_criterion
    });
  push @operations, $operation;
}

# Send the request to add the criteria.
my $result =
  $client->CustomerNegativeCriterionService()
  ->mutate({operations => \@operations});

# Display the results.
if ($result->get_value()) {
  foreach my $negative_criterion (@{$result->get_value()}) {
    printf "Campaign negative criterion with criterion ID %d and type " .
      "'%s' was added.\n",
      $negative_criterion->get_criterion()->get_id(),
      $negative_criterion->get_criterion()->get_type();
  }
}

Ruby

customer_negative_criterion_srv = adwords.service(
    :CustomerNegativeCriterionService, API_VERSION)

criteria = []

# Exclude tragedy & conflict content.
criteria << {
  :xsi_type => 'ContentLabel',
  :content_label_type => 'TRAGEDY'
}

# Exclude a specific placement.
criteria << {
  :xsi_type => 'Placement',
  :url => 'http://www.example.com'
}

# Additional criteria types are available for this service. See the types
# listed under Criterion here:
# https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

# Create operations to add each of the criteria above.
operations = criteria.map do |criterion|
  {
    :operator => 'ADD',
    :operand => {
      :criterion => criterion
    }
  }
end

# Send the request to add the criteria.
result = customer_negative_criterion_srv.mutate(operations)

# Display the results.
result[:value].each do |negative_criterion|
  puts ("Customer negative criterion with criterion ID %d and type '%s' " +
      "was added.") % [negative_criterion[:criterion][:id],
      negative_criterion[:criterion][:criterion_type]]
end

VB.NET

Using customerNegativeCriterionService As CustomerNegativeCriterionService =
    CType(user.GetService(AdWordsService.v201802.CustomerNegativeCriterionService),
        CustomerNegativeCriterionService)

  Dim criteria As New List(Of Criterion)

  ' Exclude tragedy & conflict content.
  Dim tragedyContentLabel As New ContentLabel()
  tragedyContentLabel.contentLabelType = ContentLabelType.TRAGEDY
  criteria.Add(tragedyContentLabel)

  ' Exclude a specific placement.
  Dim placement As New Placement()
  placement.url = "http://www.example.com"
  criteria.Add(placement)

  ' Additional criteria types are available for this service. See the types listed
  ' under Criterion here:
  ' https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

  ' Create operations to add each of the criteria above.
  Dim operations As New List(Of CustomerNegativeCriterionOperation)
  For Each criterion As Criterion In criteria
    Dim negativeCriterion As New CustomerNegativeCriterion()
    negativeCriterion.criterion = criterion
    Dim operation As New CustomerNegativeCriterionOperation()
    operation.operator = [Operator].ADD
    operation.operand = negativeCriterion
    operations.Add(operation)
  Next

  Try
    ' Send the request to add the criteria.
    Dim result As CustomerNegativeCriterionReturnValue =
        customerNegativeCriterionService.mutate(operations.ToArray())

    ' Display the results.
    For Each negativeCriterion As CustomerNegativeCriterion In result.value
      Console.WriteLine("Customer negative criterion with criterion ID {0} and type '{1}' " +
          "was added.", negativeCriterion.criterion.id,
          negativeCriterion.criterion.type)
    Next
  Catch e As Exception
    Throw New System.ApplicationException("Failed to set customer negative criteria.", e)
  End Try

End Using

完整示例代码

发送以下问题的反馈:

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