Hello,
I want to remove negative keywords list via Google Ads API.
I am able to remove non-video campaigns from negative keyword list and then remove negative keywords list.
But when VIDEO campaign is attached to negative keyword list then I am not able to deattach from negative keyword list via Google Ads API (due to Google ADS API limitation for VIDEO campaigns). So I am using Google Ads script for removing VIDEO campaigns from negative keyword list.
When active VIDEO campaign is attached to negativekeyword list then I am able to get and later to remove it from negative keyword list.
But if VIDEO campaign with status "REMOVED" is attached to negative keyword list then I am not able to get it and remove it from shared set via Google Ads Script.
I have created script 'GET_REMOVED_CAMPAIGNS_FROM_NEGATIVE_KEYWORD_LIST' in MCC
773-517-3772.
We have such shared set (Negative Keyword list) :
Account ID "1317804939"
Shared Set ID "1317804939"
Shared Set Name "******************************* - AUTO_DELETED"
Number of Video Campaigns attached to shared set: 1
Status of VIDEO campaign: "REMOVED"
Script is here:
=========================================================================================================
function getCampaignsFromSharedSet(accountId, shared_set_id) {
try {
var childAccounts = MccApp.accounts().withIds([accountId]).get();
if (!childAccounts.hasNext()) {
Logger.log('Account ' + accountId + ' not found; skipping.');
return;
}
var childAccounts = MccApp.accounts().withIds([accountId]).get();
var childAccount = childAccounts.next();
MccApp.select(childAccount);
var childAccount = AdsApp.currentAccount();
var accountId = childAccount.getCustomerId();
Logger.log('Processing account ' + accountId);
var negativeKeywordList = AdsApp.negativeKeywordLists().withIds([shared_set_id]).get().next();
var negativeKeywordListCampaignIterator = negativeKeywordList.campaigns().get();
Logger.log(negativeKeywordListCampaignIterator.totalNumEntities() + ' regular campaigns');
var negativeKeywordListVideoCampaignIterator = negativeKeywordList.videoCampaigns().get();
Logger.log(negativeKeywordListVideoCampaignIterator.totalNumEntities() + ' video campaigns');
Logger.log(negativeKeywordList.getName());
} catch (e) {
return "Getting campaigns failed with error " + e
}
return null;
}
// entrypoint
function main() {
accountId = "1317804939";
shared_set_id = "1317804939";
getCampaignsFromSharedSet(accountId, shared_set_id)
}
=========================================================================================================
How I can get/remove VIDEO campaign (with status "REMOVED") from shared set (Negative keyword list) ?
Can you check what's the problem?
Thanks
Br,
Nazar