Bidding

AdWords gives you several ways to bid for your ads, depending on what matters most to you and your business.

In the AdWords API, all bidding parameters are managed via one or both of the following:

With either object, you can use its biddingStrategyType field, its biddingScheme field, or both, to specify a bidding type. The biddingScheme allows you to set additional parameters specific to a bidding type. When both fields are specified, their types must match.

Strategy types

In the table below, the Valid Contexts column indicates whether a given BiddingStrategyType and associated BiddingScheme type can be used in one or both of the contexts mentioned above:

  • A standard strategy with a BiddingStrategyConfiguration object.
  • A portfolio strategy with a SharedBiddingStrategy object.
BiddingStrategyType BiddingScheme Descriptive name Valid Contexts
BUDGET_OPTIMIZER

No longer available after v201702. Use TARGET_SPEND instead.

BudgetOptimizerBiddingScheme Budget optimizer Standard
CONVERSION_OPTIMIZER

No longer available after v201702. Use TARGET_CPA instead.

ConversionOptimizerBiddingScheme Focus on conversions - use CPA bids Standard
ENHANCED_CPC EnhancedCpcBiddingScheme Enhanced CPC Portfolio
MANUAL_CPC ManualCpcBiddingScheme Focus on clicks - use maximum CPC bids Standard
MANUAL_CPM ManualCpmBiddingScheme Viewable CPM.

Works only with Display Network Only campaigns

Standard
MAXIMIZE_CONVERSIONS MaximizeConversionsBiddingScheme Maximize conversions

Works only with Search campaigns

Standard
PAGE_ONE_PROMOTED PageOnePromotedBiddingScheme Target search page location Portfolio
TARGET_CPA TargetCpaBiddingScheme Target cost per acquisition (CPA) - must meet eligibility requirements Portfolio
Standard
TARGET_OUTRANK_SHARE TargetOutrankShareBiddingScheme Target outranking share Portfolio
TARGET_ROAS TargetRoasBiddingScheme Target return on ad spend - must meet eligibility requirements Portfolio
TARGET_SPEND

enhancedCpcEnabled can only be set on a standard strategy.

TargetSpendBiddingScheme Maximize clicks Portfolio
Standard
NONE Special bidding strategy type used to clear the bidding strategy at AdGroup and AdGroupCriterion. Portfolio
Standard

Errors result if you try to use a BiddingStrategyType or BiddingScheme in the wrong context:

  • Using a portfolio-only type or scheme in the context of a standard strategy generates a BiddingErrors error with reason INVALID_ANONYMOUS_BIDDING_STRATEGY_TYPE.
  • Using a standard-only type or scheme in the context of a portfolio strategy generates a BiddingErrors error with reasonBIDDING_STRATEGY_NOT_SUPPORTED.

Specifying the strategy for a campaign

Standard bidding strategies

To use a standard bidding strategy with your campaign, configure the campaign's biddingStrategyConfiguration as follows:

  • If you do not need to configure additional attributes of the strategy, simply set its biddingStrategyType.
  • If you need to configure additional attributes of the strategy, such as the enhancedCpcEnabled attribute for a MANUAL_CPC strategy, set the configuration's biddingStrategyScheme.
  • Do not set the bidding strategy configuration's biddingStrategyId or biddingStrategyName.

Portfolio bidding strategies

To use a portfolio bidding strategy with your campaign, you have two options:

  1. Use an existing SharedBiddingStrategy.
  2. Use the BiddingStrategyService to create a new SharedBiddingStrategy and set its parameters.

Once you've chosen a SharedBiddingStrategy, configure your campaign to use the strategy by setting the campaign's biddingStrategyConfiguration to a configuration with the biddingStrategyId set to the shared bidding strategy's id.

Bidding strategy transitions

You can update a campaign's bidding strategy using CampaignService mutate() and a SET operation. The operand should be a Campaign with the id set to the campaign's ID, and the biddingStrategyConfiguration configured as described above in specifying the strategy for a campaign.

Overriding strategy settings

Overriding target CPA at the ad group level

The targetRoas of a standard TARGET_ROAS strategy's TargetRoasBiddingScheme can be overridden at the ad group level by setting the targetRoasOverride of the ad group's bidding strategy configuration. The other fields of the strategy's bidding scheme cannot be overridden.

To remove an override, set the targetRoasOverride of the ad group's BiddingStrategyConfiguration to 0.

Attempting to override the targetRoas of a portfolio TargetRoasBiddingScheme will result in an error.

Overriding target CPA at the ad group level

The targetCpa of a standard TARGET_CPA strategy's TargetCpaBiddingScheme can be overridden at the ad group level by adding a CpaBid to the ad group's bidding strategy configuration. The other fields of the strategy's bidding scheme cannot be overridden.

If the ad group's campaign is using a portfolio TARGET_CPA strategy, the ad group's CpaBid will not override the targetCpa of the strategy's scheme.

Overriding standard bidding strategies set at higher levels

You can't set a different bidding strategy at a lower level from that at a higher level. For example, setting a MANUAL_CPM strategy at the ad group level when a MANUAL_CPC strategy exists at the campaign level will throw an error.

You can set a MANUAL_CPC strategy at a lower level when another MANUAL_CPC exists at a higher level; however, you would be better off just setting the bid directly.

Setting bids

Bids can be set at the ad group and ad group criterion levels. A criterion bid will override an ad group bid. Attempts to set bids at the campaign level will fail.

Multiple bids of different types can be set in a single BiddingStrategyConfiguration simultaneously (for example, CpcBid and CpmBid) but only the bid that's relevant for the currently selected biddingStrategyType will be used to bid for your ads.

The following code example uses a mutate call to add a CPC bid at the ad group level.

Java

// Get the AdGroupService.
AdGroupServiceInterface adGroupService =
    adWordsServices.get(session, AdGroupServiceInterface.class);

// Create an ad group with the specified ID.
AdGroup adGroup = new AdGroup();
adGroup.setId(adGroupId);
// Update the CPC bid if specified.
if (bidMicroAmount != null) {
  BiddingStrategyConfiguration biddingStrategyConfiguration =
      new BiddingStrategyConfiguration();
  Money cpcBidMoney = new Money();
  cpcBidMoney.setMicroAmount(bidMicroAmount);
  CpcBid cpcBid = new CpcBid();
  cpcBid.setBid(cpcBidMoney);
  biddingStrategyConfiguration.setBids(new Bids[] {cpcBid});
  adGroup.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
}
// Pause the ad group.
adGroup.setStatus(AdGroupStatus.PAUSED);

// Create operations.
AdGroupOperation operation = new AdGroupOperation();
operation.setOperand(adGroup);
operation.setOperator(Operator.SET);

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

// Update ad group.
AdGroupReturnValue result = adGroupService.mutate(operations);

Removing bids

To remove a bid from a BiddingStrategyConfiguration, update its bid field to a Money object with microAmount set to 0.

Display Network criteria dimensions

For ads running on the Display Network, there are a number of different dimensions for which an ad group bid can be set. If multiple bids are set in different dimensions, the contentBidCriterionTypeGroup field can be used to specify the dimension that should be used for absolute bids. Ads on the search network will always use keyword bids.

You can also set a bid adjustment which will be used when the criterion is not in an absolute bidding dimension. It can be accessed via the bidModifier field of the BiddableAdGroupCriterion.

Bid modifiers

Campaign and ad group level bid adjustments give you more control over your bids in AdWords campaigns, providing the option to increase or decrease bids for certain criteria.

Within the AdWords API, campaign level adjustments are accessible via CampaignCriterionService and CampaignBidModifierService, and ad group level adjustments are accessible via AdGroupBidModifierService.

Retrieving bid adjustments

To retrieve existing bid adjustments, use the get() or query() method of CampaignCriterionService, AdGroupBidModifierService, or CampaignBidModifierService. Similar to other services, the get() method accepts a generic selector allowing you to select response fields and filter the results set.

The code below retrieves all bid modifiers for an ad group:

Java

public static void runExample(AdWordsServicesInterface adWordsServices,
    AdWordsSession session) throws Exception {
  // Get the AdGroupBidModifierService.
  AdGroupBidModifierServiceInterface adGroupBidModifierService =
      adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);

  // Create selector.
  Selector selector = new SelectorBuilder()
      .fields(
          AdGroupBidModifierField.CampaignId,
          AdGroupBidModifierField.AdGroupId,
          AdGroupBidModifierField.BidModifier,
          AdGroupBidModifierField.Id)
      .offset(0)
      .limit(PAGE_SIZE)
      .build();

  AdGroupBidModifierPage page = adGroupBidModifierService.get(selector);
  if (page.getEntries() != null) {
    for (AdGroupBidModifier bidModifierResult : page.getEntries()) {
      String bidModifierValue =
          bidModifierResult.getBidModifier() != null
              ? bidModifierResult.getBidModifier().toString()
              : "unset";
      System.out.printf("Campaign ID %d, AdGroup ID %d, Criterion ID %d, "
          + "has ad group level modifier: %s%n",
          bidModifierResult.getCampaignId(),
          bidModifierResult.getAdGroupId(),
          bidModifierResult.getCriterion().getId(),
          bidModifierValue);
    }
  } else {
    System.out.println("No ad group level bid modifiers were found.");
  }
}

CSharp

public void Run(AdWordsUser user, long campaignId) {
  using (AdGroupBidModifierService adGroupBidModifierService =
      (AdGroupBidModifierService) user.GetService(
          AdWordsService.v201710.AdGroupBidModifierService)) {

    // Get all ad group bid modifiers for the campaign.
    Selector selector = new Selector() {
      fields = new String[] {
      AdGroupBidModifier.Fields.CampaignId, AdGroupBidModifier.Fields.AdGroupId,
      AdGroupBidModifier.Fields.BidModifier, AdGroupBidModifier.Fields.BidModifierSource,
      Criterion.Fields.CriteriaType, Criterion.Fields.Id
    },
      predicates = new Predicate[] {
      Predicate.Equals(AdGroupBidModifier.Fields.CampaignId, campaignId)
    },
      paging = Paging.Default
    };

    AdGroupBidModifierPage page = new AdGroupBidModifierPage();

    try {
      do {
        // Get the campaigns.
        page = adGroupBidModifierService.get(selector);

        // Display the results.
        if (page != null && page.entries != null) {
          int i = selector.paging.startIndex;
          foreach (AdGroupBidModifier adGroupBidModifier in page.entries) {
            string bidModifier = (adGroupBidModifier.bidModifierSpecified) ?
                adGroupBidModifier.bidModifier.ToString() : "UNSET";
            Console.WriteLine("{0}) Campaign ID {1}, AdGroup ID {2}, Criterion ID {3} has " +
                "ad group level modifier: {4} and source = {5}.",
                i + 1, adGroupBidModifier.campaignId,
                adGroupBidModifier.adGroupId, adGroupBidModifier.criterion.id, bidModifier,
                adGroupBidModifier.bidModifierSource);
            i++;
          }
        }
        selector.paging.IncreaseOffset();
      } while (selector.paging.startIndex < page.totalNumEntries);
      Console.WriteLine("Number of adgroup bid modifiers found: {0}", page.totalNumEntries);
    } catch (Exception e) {
      throw new System.ApplicationException("Failed to retrieve adgroup bid modifiers.", e);
    }
  }
}

Python

def main(client):
  # Initialize appropriate service.
  ad_group_bid_modifier_service = client.GetService(
      'AdGroupBidModifierService', version='v201710')

  # Get all ad group bid modifiers for the campaign.
  selector = {
      'fields': ['CampaignId', 'AdGroupId', 'BidModifier', 'Id'],
      'paging': {
          'startIndex': '0',
          'numberResults': str(PAGE_SIZE)
      }
  }

  # Set initial values.
  offset, page = 0, {}
  more_results = True

  while more_results:
    page = ad_group_bid_modifier_service.get(selector)
    if page['entries']:
      for modifier in page['entries']:
        value = (modifier['bidModifier'] if 'bidModifier' in modifier
                 else 'unset')
        print ('Campaign ID %s, AdGroup ID %s, Criterion ID %s has ad group '
               'level modifier: %s' %
               (modifier['campaignId'], modifier['adGroupId'],
                modifier['criterion']['id'], value))

      # Increment values to request the next page.
      offset += PAGE_SIZE
      selector['paging']['startIndex'] = str(offset)
    else:
      print 'No ad group bid modifiers returned.'
    more_results = int(page['totalNumEntries']) > offset

PHP

public static function runExample(AdWordsServices $adWordsServices,
    AdWordsSession $session) {
  $adGroupBidModifierService =
      $adWordsServices->get($session, AdGroupBidModifierService::class);

  // Create a selector to select all ad group bid modifiers.
  $selector = new Selector();
  $selector->setFields(
      ['Id', 'AdGroupId', 'CampaignId', 'BidModifier']);
  $selector->setOrdering([new OrderBy('CampaignId', SortOrder::ASCENDING)]);
  $selector->setPaging(new Paging(0, self::PAGE_LIMIT));

  $totalNumEntries = 0;
  do {
    // Retrieve ad group bid modifiers one page at a time, continuing to
    // request pages until all ad group bid modifiers have been retrieved.
    $page = $adGroupBidModifierService->get($selector);

    // Print out some information for each ad group bid modifier.
    if ($page->getEntries() !== null) {
      $totalNumEntries = $page->getTotalNumEntries();
      foreach ($page->getEntries() as $adGroupBidModifier) {
        printf(
            "Campaign ID %d, ad group ID %d, criterion ID %d has ad group "
                . "level modifier: %s\n",
            $adGroupBidModifier->getCampaignId(),
            $adGroupBidModifier->getAdGroupId(),
            $adGroupBidModifier->getCriterion()->getId(),
            ($adGroupBidModifier->getBidModifier() === null)
                ? 'none' : $adGroupBidModifier->getBidModifier()
        );
      }
    }

    $selector->getPaging()->setStartIndex(
        $selector->getPaging()->getStartIndex() + self::PAGE_LIMIT);
  } while ($selector->getPaging()->getStartIndex() < $totalNumEntries);

  printf("Number of results found: %d\n", $totalNumEntries);
}

Perl

sub get_ad_group_bid_modifier {
  my $client = shift;

  # Create selector.
  my $paging = Google::Ads::AdWords::v201710::Paging->new({
      startIndex    => 0,
      numberResults => PAGE_SIZE
  });
  my $selector = Google::Ads::AdWords::v201710::Selector->new({
      fields => ["CampaignId", "AdGroupId", "BidModifier", "Id"],
      paging => $paging
  });

  # Paginate through results.
  Google::Ads::AdWords::Utilities::PageProcessor->new({
      client   => $client,
      service  => $client->AdGroupBidModifierService(),
      selector => $selector
    }
    )->process_entries(
    sub {
      my ($modifier) = @_;
      my $modifier_value = $modifier->get_bidModifier() || "unset";
      printf "Campaign ID %s, AdGroup ID %s, Criterion ID %s has ad group " .
        "level modifier: %s\n", $modifier->get_campaignId(),
        $modifier->get_adGroupId(), $modifier->get_criterion()->get_id(),
        $modifier_value;
    });

  return 1;
}

Ruby

def get_ad_group_bid_modifiers(campaign_id)
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
  # when called without parameters.
  adwords = AdwordsApi::Api.new

  # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
  # the configuration file or provide your own logger:
  # adwords.logger = Logger.new('adwords_xml.log')

  bid_modifier_srv = adwords.service(:AdGroupBidModifierService, API_VERSION)

  # Get all ad group bid modifiers for the campaign.
  selector = {
    :fields => ['CampaignId', 'AdGroupId', 'Id', 'BidModifier'],
    :predicates => [
      {:field => 'CampaignId', :operator => 'EQUALS', :values => [campaign_id]}
    ],
    :paging => {
      :start_index => 0,
      :number_results => PAGE_SIZE
    }
  }

  # Set initial values.
  offset, page = 0, {}

  begin
    page = bid_modifier_srv.get(selector)
    if page[:entries]
      page[:entries].each do |modifier|
        value = modifier[:bid_modifier] || 'unset'
        puts ('Campaign ID %d, AdGroup ID %d, Criterion ID %d has ad group ' +
           'level modifier: %s') %
           [modifier[:campaign_id], modifier[:ad_group_id],
            modifier[:criterion][:id], value]
      end
      # Increment values to request the next page.
      offset += PAGE_SIZE
      selector[:paging][:start_index] = offset
    else
      puts 'No ad group level bid overrides returned.'
    end
  end while page[:total_num_entries] > offset
end

VB.NET

Public Sub Run(ByVal user As AdWordsUser, ByVal campaignId As Long)
  ' Get the AdGroupBidModifierService.
  Using adGroupBidModifierService As AdGroupBidModifierService = CType(user.GetService(
      AdWordsService.v201710.AdGroupBidModifierService), AdGroupBidModifierService)

    ' Get all ad group bid modifiers for the campaign.
    Dim selector As New Selector()
    selector.fields = New String() {
      AdGroupBidModifier.Fields.CampaignId, AdGroupBidModifier.Fields.AdGroupId,
      AdGroupBidModifier.Fields.BidModifier, AdGroupBidModifier.Fields.BidModifierSource,
      Criterion.Fields.CriteriaType, Criterion.Fields.Id
    }

    Dim predicate As New Predicate()
    predicate.field = "CampaignId"
    predicate.[operator] = PredicateOperator.EQUALS
    predicate.values = New String() {campaignId.ToString()}
    selector.predicates = New Predicate() {
      Predicate.Equals(AdGroupBidModifier.Fields.CampaignId, campaignId)
    }
    selector.paging = Paging.Default

    Dim page As New AdGroupBidModifierPage()

    Try
      Do
        ' Get the ad group bids.
        page = adGroupBidModifierService.get(selector)

        ' Display the results.
        If (Not page Is Nothing) AndAlso (Not page.entries Is Nothing) Then
          Dim i As Integer = selector.paging.startIndex
          For Each adGroupBidModifier As AdGroupBidModifier In page.entries
            Dim bidModifier As String = ""
            If adGroupBidModifier.bidModifierSpecified Then
              bidModifier = adGroupBidModifier.bidModifier.ToString()
            Else
              bidModifier = "UNSET"
            End If
            Console.WriteLine("{0}) Campaign ID {1}, AdGroup ID {2}, Criterion ID {3} has " &
              "ad group level modifier: {4}, source = {5}.",
              i + 1, adGroupBidModifier.campaignId,
              adGroupBidModifier.adGroupId, adGroupBidModifier.criterion.id,
              bidModifier, adGroupBidModifier.bidModifierSource)
            i = i + 1
          Next
        End If
        selector.paging.IncreaseOffset()
      Loop While selector.paging.startIndex < page.totalNumEntries
      Console.WriteLine("Number of adgroup bid modifiers found: {0}", page.totalNumEntries)
    Catch e As Exception
      Throw New System.ApplicationException("Failed to retrieve adgroup bid modifiers.", e)
    End Try
  End Using

Adding, updating and removing bid adjustments

Use the mutate() method of CampaignCriterionService, AdGroupBidModifierService, or CampaignBidModifierService to add or amend a bid adjustment:

  • To add a new bid modifier use the ADD operator.
  • To update an existing bid override to a new value, use the SET operator.
  • To remove a bid modifier override, use the REMOVE operator.
  • Performing an ADD operation on a an existing CampaignBidModifier, AdGroupBidModifier, or AdGroupCriterion will cause the operation to be treated like a SET.

This example demonstrates how to add a new ad group level mobile bid adjustment:

Java

public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session,
    Long adGroupId) throws Exception {
  // Get the AdGroupBidModifierService.
  AdGroupBidModifierServiceInterface adGroupBidModifierService =
      adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);

  // Create mobile platform. The ID can be found in the documentation.
  // https://developers.google.com/adwords/api/docs/appendix/platforms
  Platform mobile = new Platform();
  mobile.setId(30001L);

  AdGroupBidModifier adGroupBidModifier = new AdGroupBidModifier();
  adGroupBidModifier.setAdGroupId(adGroupId);
  adGroupBidModifier.setBidModifier(BID_MODIFIER);
  adGroupBidModifier.setCriterion(mobile);

  // Create ADD operation.
  AdGroupBidModifierOperation operation = new AdGroupBidModifierOperation();
  operation.setOperand(adGroupBidModifier);
  // Use 'ADD' to add a new modifier and 'SET' to update an existing one. A
  // modifier can be removed with the 'REMOVE' operator.
  operation.setOperator(Operator.ADD);

  // Update ad group bid modifier.
  AdGroupBidModifierReturnValue result =
      adGroupBidModifierService.mutate(new AdGroupBidModifierOperation[] {operation});
  for (AdGroupBidModifier bidModifierResult : result.getValue()) {
    System.out.printf(
        "Campaign ID %d, ad group ID %d was updated with ad group level modifier: %.4f%n",
        bidModifierResult.getCampaignId(), bidModifierResult.getAdGroupId(),
        bidModifierResult.getBidModifier());
  }
}

CSharp

public void Run(AdWordsUser user, long adGroupId, double bidModifier) {
  using (AdGroupBidModifierService adGroupBidModifierService =
      (AdGroupBidModifierService) user.GetService(
          AdWordsService.v201710.AdGroupBidModifierService)) {

    // Mobile criterion ID.
    long criterionId = 30001;

    // Create the adgroup bid modifier.
    AdGroupBidModifier adGroupBidModifier = new AdGroupBidModifier();
    adGroupBidModifier.bidModifier = bidModifier;
    adGroupBidModifier.adGroupId = adGroupId;

    Platform platform = new Platform();
    platform.id = criterionId;

    adGroupBidModifier.criterion = platform;

    AdGroupBidModifierOperation operation = new AdGroupBidModifierOperation();
    operation.@operator = Operator.ADD;
    operation.operand = adGroupBidModifier;

    try {
      // Add ad group level mobile bid modifier.
      AdGroupBidModifierReturnValue retval = adGroupBidModifierService.mutate(
          new AdGroupBidModifierOperation[] { operation });

      // Display the results.
      if (retval != null && retval.value != null && retval.value.Length > 0) {
        AdGroupBidModifier newBidModifier = retval.value[0];
        Console.WriteLine("AdGroup ID {0}, Criterion ID {1} was updated with ad group level " +
            "modifier: {2}", newBidModifier.adGroupId, newBidModifier.criterion.id,
            newBidModifier.bidModifier);
      } else {
        Console.WriteLine("No bid modifiers were added to the adgroup.");
      }
    } catch (Exception e) {
      throw new System.ApplicationException("Failed to add bid modifiers to adgroup.", e);
    }
  }
}

Python

def main(client, ad_group_id, bid_modifier):
  # Initialize appropriate service.
  ad_group_bid_modifier_service = client.GetService(
      'AdGroupBidModifierService', version='v201710')

  # Mobile criterion ID.
  criterion_id = '30001'

  # Prepare to add an ad group level override.
  operation = {
      # Use 'ADD' to add a new modifier and 'SET' to update an existing one. A
      # modifier can be removed with the 'REMOVE' operator.
      'operator': 'ADD',
      'operand': {
          'adGroupId': ad_group_id,
          'criterion': {
              'xsi_type': 'Platform',
              'id': criterion_id
          },
          'bidModifier': bid_modifier
      }
  }

  # Add ad group level mobile bid modifier.
  response = ad_group_bid_modifier_service.mutate([operation])
  if response and response['value']:
    modifier = response['value'][0]
    value = modifier['bidModifier'] if 'bidModifier' in modifier else 'unset'
    print ('Campaign ID %s, AdGroup ID %s, Criterion ID %s was updated with '
           'ad group level modifier: %s' %
           (modifier['campaignId'], modifier['adGroupId'],
            modifier['criterion']['id'], value))
  else:
    print 'No modifiers were added.'

PHP

public static function runExample(AdWordsServices $adWordsServices,
    AdWordsSession $session, $adGroupId, $bidModifier) {
  $adGroupBidModifierService =
      $adWordsServices->get($session, AdGroupBidModifierService::class);

  $operations = [];

  // Mobile criterion ID.
  $criterionId = 30001;
  // Prepare to add an ad group level override.
  $adGroupBidModifier = new AdGroupBidModifier();
  $adGroupBidModifier->setAdGroupId($adGroupId);
  $adGroupBidModifier->setCriterion(new Platform());
  $adGroupBidModifier->getCriterion()->setId($criterionId);
  $adGroupBidModifier->setBidModifier($bidModifier);

  $operation = new AdGroupBidModifierOperation();

  // Create an ad group bid modifier operation and add it to the list.
  $operation->setOperator(Operator::ADD);
  $operation->setOperand($adGroupBidModifier);
  $operations[] = $operation;

  // Create the ad group bid modifier on the server and print out some
  // information for each created ad group criterion.
  $result = $adGroupBidModifierService->mutate($operations);
  foreach ($result->getValue() as $adGroupBidModifier) {
    printf(
        "Ad group ID %d, criterion ID %d was updated with "
            . "ad group level modifier: %s\n",
        $adGroupBidModifier->getAdGroupId(),
        $adGroupBidModifier->getCriterion()->getId(),
        $adGroupBidModifier->getBidModifier()
    );
  }
}

Perl

sub add_ad_group_bid_modifier {
  my $client      = shift;
  my $ad_group_id = shift;

  # Create mobile platform. The ID can be found in the documentation.
  # https://developers.google.com/adwords/api/docs/appendix/platforms
  my $mobile = Google::Ads::AdWords::v201710::Platform->new({id => 30001});

  # Create the bid modifier.
  my $modifier = Google::Ads::AdWords::v201710::AdGroupBidModifier->new({
      adGroupId   => $ad_group_id,
      criterion   => $mobile,
      bidModifier => BID_MODIFIER
  });

  # Create ADD operation.
  my $operation =
    Google::Ads::AdWords::v201710::AdGroupBidModifierOperation->new({
      operator => "ADD",
      operand  => $modifier
    });

  # Update campaign criteria.
  my $result =
    $client->AdGroupBidModifierService()->mutate({operations => [$operation]});

  # Display campaign criteria.
  if ($result->get_value()) {
    foreach my $modifier (@{$result->get_value()}) {
      printf "Ad Group ID '%s', criterion ID '%s', " .
        "and type '%s' was modified with bid %.2f.\n",
        $modifier->get_adGroupId(),
        $modifier->get_criterion()->get_id(),
        $modifier->get_criterion()->get_type(),
        $modifier->get_bidModifier();
    }
  } else {
    print "No ad group bid modifier was added.\n";
  }

  return 1;
}

Ruby

def add_ad_group_bid_modifier(ad_group_id, bid_modifier)
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
  # when called without parameters.
  adwords = AdwordsApi::Api.new

  # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
  # the configuration file or provide your own logger:
  # adwords.logger = Logger.new('adwords_xml.log')

  bid_modifier_srv = adwords.service(:AdGroupBidModifierService, API_VERSION)

  # Mobile criterion ID.
  criterion_id = 30001

  # Prepare to add an ad group level override.
  operation = {
    # Use 'ADD' to add a new modifier and 'SET' to update an existing one. A
    # modifier can be removed with the 'REMOVE' operator.
    :operator => 'ADD',
    :operand => {
      :ad_group_id => ad_group_id,
      :criterion => {
        :xsi_type => 'Platform',
        :id => criterion_id
      },
      :bid_modifier => bid_modifier
    }
  }

  # Add ad group level mobile bid modifier.
  response = bid_modifier_srv.mutate([operation])
  if response and response[:value]
    modifier = response[:value].first
    value = modifier[:bid_modifier] || 'unset'
    puts ('Campaign ID %d, AdGroup ID %d, Criterion ID %d was updated with ' +
        'ad group level modifier: %s') %
           [modifier[:campaign_id], modifier[:ad_group_id],
            modifier[:criterion][:id], value]
  else
    puts 'No modifiers were added.'
  end
end

VB.NET

Public Sub Run(ByVal user As AdWordsUser, ByVal adGroupId As Long, ByVal bidModifier As Double)
  Using adGroupBidModifierService As AdGroupBidModifierService = CType(user.GetService(
      AdWordsService.v201710.AdGroupBidModifierService),
          AdGroupBidModifierService)

    ' Mobile criterion ID.
    Dim criterionId As Long = 30001

    ' Create the adgroup bid modifier.
    Dim adGroupBidModifier As New AdGroupBidModifier()
    adGroupBidModifier.bidModifier = bidModifier
    adGroupBidModifier.adGroupId = adGroupId

    Dim platform As New Platform()
    platform.id = criterionId

    adGroupBidModifier.criterion = platform

    Dim operation As New AdGroupBidModifierOperation()
    operation.operator = [Operator].ADD
    operation.operand = adGroupBidModifier

    Try
      ' Add ad group level mobile bid modifier.
      Dim retval As AdGroupBidModifierReturnValue = adGroupBidModifierService.mutate(
        New AdGroupBidModifierOperation() {operation})

      ' Display the results.
      If Not retval Is Nothing AndAlso Not retval.value Is Nothing AndAlso
        retval.value.Length > 0 Then
        Dim newBidModifier As AdGroupBidModifier = retval.value(0)
        Console.WriteLine("AdGroup ID {0}, Criterion ID {1} was updated with ad group " &
          "level modifier: {2}", newBidModifier.adGroupId, newBidModifier.criterion.id,
          newBidModifier.bidModifier)
      Else
        Console.WriteLine("No bid modifiers were added to the adgroup.")
      End If
    Catch e As Exception
      Throw New System.ApplicationException("Failed to add bid modifiers to adgroup.", e)
    End Try
  End Using

Migrating the bidding strategy configuration override of ad groups and keywords

Starting in v201705, the bidding strategy will no longer be allowed to be overridden at the ad group or ad group criterion levels. This means the biddingStrategyType, biddingStrategyId, and biddingScheme cannot be set at those levels. The bidding strategy can only be set at the campaign level. The only exception is that the biddingStrategyType can be set to NONE at the ad group and ad group criterion levels. This was done to simplify bidding strategies as overrides are not often used.

To migrate:

  • There is the option in all versions of setting the biddingStrategyType at the ad group and keyword criterion levels to NONE. This allows these objects to then inherit the bidding strategy configuration from the campaign. The fields related to the biddingStrategyType such as the biddingStrategyId will be cleared when NONE is specified.
  • If multiple ad groups under the same campaign do need different bidding strategies, then create separate campaigns for each of the ad groups.

Send feedback about...

AdWords API
AdWords API
Need help? Visit our support page.