Link Checker Script - Draft & Campaign exclusion

123 views
Skip to first unread message

Michele Mereu

unread,
May 26, 2021, 3:20:48 AM5/26/21
to Google Ads Scripts Forum
Hi guys,

is there a way with this script 

to exclude draft and experiment campaigns?

if they are "ended" it seems the script seems them as active, and fires false positive alerts
thanks!

Google Ads Scripts Forum Advisor

unread,
May 26, 2021, 5:10:17 AM5/26/21
to adwords...@googlegroups.com
Hi Michelle,

Thanks for reaching out. Harry here form the Google Ads Scripts Team.

For us to be able to assist you, kindly provide the script's name and your CID so that I could check this on our end and investigate on what caused the issue. Kindly provide also a shareable link to the template spreadsheet you are using and point me to where the script deemed the Campaigns as ACTIVE even through they are in the ENDED status. Please provide screenshots if possible.

You may send them here or privately via the reply to author option. Note that you may need to join the Google Group for you to use this option. If this option is not available at your end still, you may send it through our email (googleadsscr...@google.com) instead.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2HxvXA:ref

Google Ads Scripts Forum Advisor

unread,
May 27, 2021, 1:43:50 AM5/27/21
to adwords...@googlegroups.com
Hi Michele,

Thanks for providing the requested details and for your patience here.

I have checked that we should update the getUrlsBySelector and checkUrls functions so that the script would not retrieve draft and experiment campaign. To do this you would need first retrieve the list of Base Campaigns IDs and filter the entity selectors with the CampaignID with something like the following:
  var campaignIds = []
  var campaignIterator = AdsApp.campaigns().withCondition('CampaignExperimentType = BASE').get();
  while (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    campaignIds.push(campaign.getId());
  }
  
  var adIterator = adSelector.withCondition('CampaignId NOT_IN ['+ campaignIds +']').get();
  while (adIterator.hasNext()) {
    var ad = adIterator.next();
    Logger.log(ad.getId() + ' ' +  ad.getCampaign().getName());
  }
I have attached here an updated version of the script for your reference where I created a separate function to retrieve the base campaign IDs on line 543 and added withCondition methods in lines 562 and 608. Please take note to update the spreadsheet URL and the email address. Kindly try this at your end and let me know how it goes.

Let me also know if there's anything else I can assist you with.
script.txt

Michele Mereu

unread,
Jun 3, 2021, 6:36:55 AM6/3/21
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor, Dreamteam
Thanks Harry, very helpful. 

It seems it worked well excluding draft and experiment campaigns!

One question, does the new script you sent fire also for 301/302 redirects IF the sheet is set with Valide Response Codes 200 only?
thanks

--
-- 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 a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/j_1HtsCNzTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/OHLf8000000000000000000000000000000000000000000000QTR3WV00Am5TSV9HR360eFTjim2DtA%40sfdc.net.


--
Micky Mereu
Managing Director
emichel...@midsummer.agency
t+39 070 796 8688
aOpen Campus, Cagliari, Italy
wmidsummer.agency

Google Ads Scripts Forum Advisor

unread,
Jun 3, 2021, 11:40:51 PM6/3/21
to adwords...@googlegroups.com, drea...@midsummer.agency
Hello,

Thanks for coming back. Yes, the script will work as intended and based on the specified options in the spreadsheet template (Eg. the list of valid response codes). We just added a code for the script to exclude draft and experiment campaigns when running. Please see also How it works section for further details.
Reply all
Reply to author
Forward
0 new messages