Delete campaigns, adgroup, audieces

59 views
Skip to first unread message

Shivam Kumar

unread,
Mar 18, 2024, 5:11:23 AM3/18/24
to Google Ads API and AdWords API Forum
Hi there,
I am creating (https://github.com/googleads/google-ads-python/blob/main/examples/basic_operations/add_campaigns.py) campaign, adgroups and audiences through python code. The create, update and fetch operation is successful, When I tried to delete (https://github.com/googleads/google-ads-python/blob/main/examples/basic_operations/remove_campaign.py) campaign, ad-group or audiences. the resource is getting deleted but when I fetch all campaign, ad-groups or audiences ( https://github.com/googleads/google-ads-python/blob/main/examples/basic_operations/get_campaigns.py). It returns the deleted campaigns, ad-groups and audiences also. How shall I filter out?

Google Ads API Forum Advisor

unread,
Mar 18, 2024, 11:30:07 AM3/18/24
to shiv...@vaticai.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team.

After reviewing your concern, I understand that when you are trying to delete campaigns via the API, along with the campaign, it also returns ad groups and audience. Please take note that the removal of a campaign will return campaign resources in the format of "customers/{customer_id}/campaigns/{campaign_id}," as per the API documentation.

If an audience or ad group is included in a campaign that is going to be deleted, that audience or ad group is also removed from the campaign. Restricting the removal of an audience or ad group under a campaign that is being removed is not possible. 

I hope it helps.

This message is in relation to case "ref:!00D1U01174p.!5004Q02s00xH:ref" (ADR-00227637)

Thanks,
 
Google Logo Google Ads API Team


Zweitze

unread,
Mar 18, 2024, 2:29:24 PM3/18/24
to Google Ads API and AdWords API Forum
You should filter on the field Status: status "removed" means that the campaign/group/ad/keyword/etc. is removed.

Background: One would think that when deleting a campaign after spending 1000 Euro on it, Google forgets about the money. But... too bad, you still owe Google the money. Now, to prevent people complaining that the totals don't match, the campaign is not actually deleted. It just gets the status "removed" and becomes read-only.

In the UI you can also toggle that filter. The difference is, in the UI the (first-time) default is just "active", in the API the default is "active" plus "paused" plus "removed".

Google Ads API Forum Advisor

unread,
Mar 19, 2024, 2:16:01 AM3/19/24
to zwe...@gmail.com, adwor...@googlegroups.com
Hi,

By reviewing your concern, I understand that you are facing "OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE" error while performing an operation on deleted campaigns or adgroups.

Kindly note that you will encounter this error when you perform an operation on the resource which is removed. You can use the below query to get active and paused status campaigns and adgroups.

Query:"SELECT ad_group.status, ad_group_criterion.status, campaign.status, campaign.id, campaign.name, ad_group.id, ad_group.name FROM ad_group_audience_view WHERE ad_group.status != 'REMOVED' AND ad_group_criterion.status != 'REMOVED' AND campaign.status != 'REMOVED'"

You can perform an operation on the retrieved campaigns and ad groups from the provided above query. If you are not looking for this and still facing any issues please provide us with the report your retrieving removed campaigns, ad-groups and audiences screenshot with corresponding complete API request and response logs for specific CID that you are performing operations.
Reply all
Reply to author
Forward
0 new messages