AdWords API

Ad Group Level Bid Modifiers

Ad group level bid adjustments give you more control over your bids in AdWords campaigns, providing the option to individually override campaign-level bids for certain criteria. Within the AdWords API, ad group level adjustments are accessible via AdGroupBidModifierService.

This guide contains examples in Java, refer to the client libraries page for examples in other languages.

Retrieving bid adjustments

In order to retrieve existing bid adjustments, use the AdGroupBidModifierService get request. Similarly to other services, the get method accepts a generic selector allowing you to choose response fields and to filter the results set.

The code below will retrieve the first 10 existing bid modifiers across all your campaigns:

// Get the AdGroupBidModifierService.
AdGroupBidModifierServiceInterface bidModifierService =
    adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);

// Create selector.
Selector selector = new Selector();
selector.setFields(
    new String[] {"CampaignId", "AdGroupId", "Id", "BidModifier"});
selector.setPaging(new Paging(0, 10));

// Make a 'get' request.
AdGroupBidModifierPage page = bidModifierService.get(selector);

// Display bid modifiers.
if (page.getEntries() != null) {
  for (AdGroupBidModifier modifier : page.getEntries()) {
    String value = (modifier.getBidModifier() == null) ?
        "unset" : String.valueOf(modifier.getBidModifier())
    System.out.println("Campaign ID " + modifier.getCampaignId()
        + ", AdGroup ID " + modifier.getAdGroupId()
        + ", Criterion ID " + modifier.getCriterion().getId()
        + " has ad group level modifier: " + value);
  }
} else {
  System.out.println("No bid modifiers were found.");
}

Adding, updating and removing bid adjustments

Use AdGroupBidModifierService mutate to add or amend a bid adjustment. To add a new bid modifier for a combination of campaign, ad group and criterion IDs, use the ADD operator; to update an existing bid override to a new value, use the SET operator. No value will be returned if no ad group level override was set. To remove a bid modifier override, use the REMOVE operator.

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

// Get the AdGroupBidModifierService.
AdGroupBidModifierServiceInterface bidModifierService =
    adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);

// Set values for ad group, criterion IDs and bid modifier.
long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");
// Mobile criterion ID.
long criterionId = 30001;
double bidModifier = 1.1;

// Create criterion and bid modifier locally.
Criterion criterion = new Platform();
criterion.setId = criterionId;

AdGroupBidModifier modifier = new AdGroupBidModifier();
modifier.setAdGroupId(adGroupId);
modifier.setCriterion(criterion);
modifier.setBidModifier = bidModifier;

// Create operations.
AdGroupBidModifierOperation operation = new AdGroupBidModifierOperation();
operation.setOperand(campaign);
operation.setOperator(Operator.ADD);
AdGroupBidModifierOperation[] operations =
    new AdGroupBidModifierOperation[] {operation};

// Execute mutate request.
AdGroupBidModifierReturnValue result = bidModifierService.mutate(operations);

// Display result.
for (AdGroupBidModifier modifier : result.getValue()) {
  String value = (modifier.getBidModifier() == null) ?
      "unset" : String.valueOf(modifier.getBidModifier())
  System.out.println("Campaign ID " + modifier.getCampaignId() + ", AdGroup ID "
      + modifier.getAdGroupId() + ", Criterion ID " + modifier.getCriterion().getId()
      + " was updated with ad group level modifier: " + value);
}

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.