Delete campaign extensions (site links)

470 views
Skip to first unread message

Imran Tufail

unread,
Jun 29, 2016, 5:06:27 AM6/29/16
to AdWords API Forum
I want to delete the site links using api but not succeeded yet. Can i delete the x number of site links by passing the feedItemId  list. Here is the chunk of code i am using 

campaign_extension_setting_service = client.GetService(
'CampaignExtensionSettingService', version='v201605')
campaign_extension_setting = {
'campaignId': campaign_id,
'extensionType': 'SITELINK',
'extensionSetting':{
'extensions':site_link_ids
}
}
operation = {
'operator': 'REMOVE',
'operand': campaign_extension_setting
}
response = campaign_extension_setting_service.mutate([operation])

Joyce Lava

unread,
Jun 29, 2016, 5:48:18 AM6/29/16
to AdWords API Forum
Hi Imran,

To delete Ad extensions on a campaign, you only need to set the campaignId and extensionType using the CampaignExtensionSettingService with REMOVE operator. This will remove all ad extensions on the campaign level with specified extensionType(e.g sitelink). Please let us know if this is what you need to do.

Thanks and Regards,
Joyce, AdWords API Team

Imran Tufail

unread,
Jun 29, 2016, 5:58:42 AM6/29/16
to AdWords API Forum
Thank you for replying but you have not read my question properly. I want to delete x number of site links not all. e.g I want to delete sitelink with FeedItemId 8848884. As from Adwords documentation FeedItemId is the unique identifier of the site link.
Message has been deleted

Anup Pathak

unread,
Jun 29, 2016, 9:50:34 AM6/29/16
to AdWords API Forum

first you have to fetch all campaign sitelinks, and skip those you would like to remove from list and re-add remaining sitelinks to campaign, you cannot remove single sitelink from campaign, 

please check url and update ad extensions
https://developers.google.com/adwords/api/docs/guides/extension-settings#migration_steps

Joyce Lava

unread,
Jun 29, 2016, 10:54:27 PM6/29/16
to AdWords API Forum
Hi Imran,

Sorry for the confusion but unfortunately, AdWords API does not support deleting the sitelinks one by one or by list from the campaign level. However, as a workaround, after performing the steps in my previous post (will result on deleting all ad extensions with extensionType = sitelinks in the campaign), you need to re-add in the campaign the sitelinks that you still need. 

And yes, FeedItemId is the unique identifier of the feed item however, extesionSetting in CampaignExtensionSettingService is only required for operators ADD and SET. I tried doing the scenario in my test account passing a list of feedItemId in the CampaignExtensionSettingService with REMOVE operator and the list was ignored in the SOAP request. FeedItemId is uniquely identified if you are deleting a FeedItem using the FeedItemService and not deleting the relationship between Ad Extension and the Campaign.

Thanks,
Joyce, AdWords API Team

Imran Tufail

unread,
Jul 1, 2016, 8:51:22 AM7/1/16
to AdWords API Forum
Hi Joyce!

Thank you for a very clear answer. I have another question. If i re-add the site links that i still need, Do the statistics for these site links (clickthrough rate etc) remains or it will be lost and initialised from start. as the re-added sitelinks will behave as new site links.

Regards
Imran Tufail

Joyce Lava

unread,
Jul 3, 2016, 10:49:27 PM7/3/16
to AdWords API Forum
Hi Imran,

After further investigation using my test account, you can use the SET operator instead of REMOVE. Since you need to retain other sitelinks (and their statistics) in the Ad Extension associated in the campaign, you can do a SET with all the extensionSetting you want to keep and all other sitelinks that are missing in the request will be dropped from the Ad Extensions of the campaign. 

Please let us know if this helps.
Reply all
Reply to author
Forward
0 new messages