Hi,Is it possible to remove campaign level sitelinks using Google Scripts? I know you can use .removeSitelink() on a campaign or by using .setEndDate() but is it possible to actually delete them from the account?
Also what is the best way of removing sitelinks that have no associations?Thank you
function main() {
var campaign = AdsApp.campaigns().withCondition("Name = 'CAMPAIGN_NAME'").get().next();
var sitelinks = campaign.extensions().sitelinks().get();
while(sitelinks.hasNext()) {
var sitelink = sitelinks.next();
campaign.removeSitelink(sitelink);
}
}
--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scripts+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/e9cb2bd1-6013-4916-8015-a45e0e0c66a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,Removing a sitelink from an account, campaign or ad group is effectively deleting the sitelink from the account. You can remove all sitelinks from a campaign with the following code without referencing the sitelink ID:function main() {
var campaign = AdsApp.campaigns().withCondition("Name = 'CAMPAIGN_NAME'").get().next();
var sitelinks = campaign.extensions().sitelinks().get();
while(sitelinks.hasNext()) {
var sitelink = sitelinks.next();
campaign.removeSitelink(sitelink);
}
}Please let us know if you have any other questions.Regards,MattGoogle Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/8faeb329-3a33-4197-a35b-12d0163e928d%40googlegroups.com.