Google Ads API is returning to beta status. Please read our blog post for more details.

Targeting Settings for Remarketing

Once you've added a user list to an ad group or campaign as a criterion, it's ready to go. However, it may not be targeting exactly how you'd expect.

To verify that the targeting is working as intended, check the targeting_setting on ad groups or campaigns by requessting the ad_group.targeting_setting.target_restrictions field from the ad_group resource in a search query.

You can set up details on how your various criteria types are used for targeting by setting the TargetingSetting field with an array of target_restrictions. Each TargetRestriction lets you control whether a type of criteria uses the bid_only option or not.

When setting bid_only to true, the targeting setting will be set to "Observation", and the criteria won't be used to restrict traffic, but will allow you to bid differently for different users on your lists. Setting bid_only to false sets targeting setting to "Targeting" and enables the criteria to restrict ad group traffic only to users on the targeted list.

By default, bid_only is set to false, which means the targeting setting will be set to "Targeting". If you're adding remarketing lists to your main search campaign, consider changing the targeting setting of bid_only to true. If you're setting up a duplicate campaign for remarketing lists for search ads, keep the targeting of bid_only set to false.

Here's an example that uses the Java client library to update the targeting_setting on an ad group so that bid_only is true for TargetRestriction instances with a targeting_dimension of AUDIENCE. First, we retrieve all the ad_group.targeting_setting.target_restrictions from the ad group with the provided ID.

String searchQuery =
    "SELECT,, ad_group.targeting_setting.target_restrictions "
        + "FROM ad_group "
        + "WHERE = "
        + adGroupId;

Next, we loop through the target restrictions and reconstruct the TargetingSetting objects. If we encounter a TargetRestriction with a targeting_dimension of AUDIENCE and a bid_only value of false, we'll update the TargetRestriction object's bid_only field to true (or "Observation") and add it to our TargetingSetting object.

Otherwise, we add the TargetRestriction object as returned from the server to the TargetingSetting. It is important to note that we must reconstruct and pass the entire TargetingSetting object back to Google Ads. Google will assume that any target_restrictions missing from the TargetingSetting should be removed.

for (TargetRestriction targetRestriction : targetRestrictions) {
  TargetingDimension targetingDimension = targetRestriction.getTargetingDimension();
  boolean bidOnly = targetRestriction.getBidOnly().getValue();
      "- Targeting restriction with targeting dimension '%s' and bid only set to '%b'.%n",
      targetingDimension, bidOnly);
  // Adds the target restriction to the TargetingSetting object as is if the targeting
  // dimension has a value other than AUDIENCE because those should not change.
  if (!targetingDimension.equals(TargetingDimension.AUDIENCE)) {
  } else if (!bidOnly) {
    shouldUpdateTargetingSetting = true;
    // Adds an AUDIENCE target restriction with bid_only set to true to the targeting
    // setting object. This has the effect of setting the AUDIENCE target restriction to
    // "Observation". For more details about the targeting setting, visit

Finally, if we do encounter a target restriction that requires updating, we will update the ad group with the new targeting settings.

private void updateTargetingSetting(
    GoogleAdsClient googleAdsClient,
    long customerId,
    long adGroupId,
    TargetingSetting targetingSetting) {
  // Creates the ad group service client.
  try (AdGroupServiceClient adGroupServiceClient =
      googleAdsClient.getLatestVersion().createAdGroupServiceClient()) {
    // Creates an ad group object with the proper resource name and updated targeting setting.
    AdGroup adGroup =
            .setResourceName(ResourceNames.adGroup(customerId, adGroupId))
    // Constructs an operation that will update the ad group, using the FieldMasks utility to
    // derive the update mask. This mask tells the Google Ads API which attributes of the
    // ad group you want to change.
    AdGroupOperation operation =
    // Sends the operation in a mutate request.
    MutateAdGroupsResponse response =
            Long.toString(customerId), ImmutableList.of(operation));
    // Prints the resource name of the updated object.
        "Updated targeting setting of ad group with resourceName '%s'; set the AUDIENCE "
            + "target restriction to 'Observation'.%n",

The process for setting the bid_only field on campaigns is nearly identical.