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

Remove an extension setting

Behind the scenes, the extension setting services still use feeds to control your ad extensions. The ExtensionFeedItem is a wrapper over a FeedItem that handles much of the complication for you, so you can just focus on content.

What that means is that, when it comes to removing an extension setting, there are a few loose ends you may have to tie up. A functional extension setting is made up of both some set of extension feed items and either one CustomerExtensionSetting, CampaignExtensionSetting, or AdGroupExtensionSetting. You can delete the extension setting, which will remove the association between the extension feed items and that resource, but the extension feed items will still exist and can be re-used with other extension settings in the future. You can also update an extension setting to use a different set of extension feed items, but again unused feed items will continue to exist.

To clean this up, you will need to make a followup call to the ExtensionFeedItemService to remove unwanted extension feed items that are no longer associated with any extension settings.

Remove the entire extension setting

The example below assumes we want to remove both the extension setting and extension feed item that were created in the previous steps of this guide. Removing the extension setting doesn't automatically remove the extension feed items, so that must be done in a separate step.

Ruby

client = Google::Ads::GoogleAds::GoogleAdsClient.new

operation = client.operation.remove_resource.campaign_extension_setting(extension_setting_resource_name)
client.service.campaign_extension_setting.mutate_campaign_extension_settings(customer_id, [operation])

operation = client.operation.remove_resource.extension_feed_item(efi_resource_name)
client.service.extension_feed_item.mutate_extension_feed_items(customer_id, [operation])
    

Remove an extension feed item from an existing setting

Alternatively, if you want to keep the extension setting but change which extension feed items it uses, you should update the extension setting and set the full set of extension settings to use. Remember that this doesn't completely remove the extension feed item; it just disassociates it from this extension setting.

Ruby

client = Google::Ads::GoogleAds::GoogleAdsClient.new

operation = client.operation.update_resource.campaign_extension_setting(extension_setting_resource_name) do |ces|
  # This list does not contain the previous resource name, and only contains a
  # new, separate extension feed item. The campaign extension setting will be
  # updated to remove the old one and add the new one.
  ces.extension_feed_items << new_efi_resource_name
end

client.service.campaign_extension_setting.mutate_campaign_extension_settings(customer_id, [operation])
    

You may then follow the instructions above to remove the now unused extension feed item, if desired.