How can we automate the exclusion of certain top level domains?

277 views
Skip to first unread message

Yves Frateur

unread,
Nov 28, 2019, 6:50:08 AM11/28/19
to Google Ads Scripts Forum

We are trying to automate the exclusion of certain top level domains using Google Ads scripts.


We have tried different scripts (this and this) that successfully exclude domains if they contain a certain string. But CONTAINS also excludes overlapping domains, for example:

.co will also exclude .com, .co.uk, ...


We tried to use conditions, but these only take a single String and no Arrays. Therefore we have to chain them, but too many chained conditions will crash the script


Does not work

.withCondition(x DOES_NOT_CONTAIN '.com, .co.uk')


Does work (but crashes after too many chained conditions)

.withCondition(x DOES_NOT_CONTAIN '.com')
.withCondition(x DOES_NOT_CONTAIN '.co.uk')


We also tried to exclude with .co/ and .co?, but that will still allow regular .co domains.

.

So the question is, how do we exclude specific TLD's, without overlap? 

For example: how do we exclude .co, without excluding .com, .co.uk, ... ?

Sigurd

unread,
Nov 28, 2019, 2:13:38 PM11/28/19
to Google Ads Scripts Forum
Hi Yves,

Sounds like something you could use regex for.
You'd probably wanna fetch the URLs first and then loop through them afterwards with the regex as filter

Perhaps something in the neighborhood of this 

.*(\.co$)|(.*\.co\/.*)

Try a page such as this one https://regex101.com/ to get the regex working with your examples


/sigurd

Google Ads Scripts Forum Advisor

unread,
Nov 29, 2019, 2:41:30 AM11/29/19
to adwords...@googlegroups.com
Hi Yves,

Thanks for reaching out.

I am afraid that there is no possible way or available operation to filter the script so that the placement URLs that will only return are URL with '.co'. The only possible way is to have a list of placement URL from a Google spreadsheet which you want to be processed by the third party script.

If you have further questions with the third party script, you can reach out to the author of the script. Our team doesn't support third party scripts.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5001UODSxB:ref
Reply all
Reply to author
Forward
0 new messages