Auto add Exact match keywords as Negatives to BMM campaigns

532 views
Skip to first unread message

dstep...@resolutionmedia.com

unread,
Mar 21, 2018, 4:28:31 PM3/21/18
to AdWords Scripts Forum
Hello,

I run my accounts with 2 sorts of campaigns for any theme; exact and BMM match keywords

Does a script exist which would automatically apply an exact match negative to my BMM campaign if I add a (positive) exact match keyword to my Exact campaign?

eg.
Campaign Exact: Tents_Exact
Campaign BMM; Tents_BMM

I add [family tents] in the Tents_Exact campaign

Automatically, -[family tents] is add in a negative list to Tents_BMM

Hope this makes sense, and thanks!

Thea Vega (AdWords Scripts Team)

unread,
Mar 22, 2018, 4:47:25 AM3/22/18
to AdWords Scripts Forum
Hi,

Based on my understanding, you would want a script that will automatically apply a negative keyword on one specific campaign when an exact positive keyword will be added on another specific campaign. If so, please note that you can only build a keyword on an AdGroup level using KeywordBuilder

With this in mind, please see below script as reference based on your requirements to help you get started.

function main() {
  //you may change these depending on your requirements
 
var posCampaign = "INSERT_POSITIVE_CAMPAIGN_NAME_HERE";
 
var negCampaign = "INSERT_NEGATIVE_CAMPAIGN_NAME_HERE";
 
var kw =['[INSERT_EXACT_MATCH_KW_1_HERE]','[INSERT_EXACT_MATCH_KW_2_HERE]'];
 
 
var campaignSelector = AdWordsApp
 
.campaigns()
  //fetches two specific campaigns
 
.withCondition("Name IN ['"+posCampaign+"','"+negCampaign+"']");
 
 
var campaignIterator = campaignSelector.get();
 
while (campaignIterator.hasNext()) {
   
var campaign = campaignIterator.next();
   
Logger.log(campaign.getName());
   
   
for(var i=0;i < kw.length;i++){
     
Logger.log("%s %s",i,kw[i]);
     
     
if (campaign.getName() == posCampaign){
       
var adGroupSelector = campaign.adGroups().get();
       
while (adGroupSelector.hasNext()) {
         
var adGroup = adGroupSelector.next();
         
         
//creates the positive keyword on an adgroup level
         
//note that all adgroups on this specific campaign will have positive exact match keywords created

         
var keywordOperation = adGroup.newKeywordBuilder()
         
.withText(kw[i])
         
.withCpc(1.5)
         
.build();
         
var keyword = keywordOperation.getResult();
       
}
     
}
     
else if (campaign.getName() == negCampaign){
        //creates the negative exact match keyword on a campaign level
        campaign
.createNegativeKeyword(kw[i]);
     
}
   
}
 
}
}

I would suggest for you to Preview the script first to see if it is within your requirements. Let me know if you face any issues with the script.

Thanks,
Thea
AdWords Scripts Team

Martijn Kraan

unread,
Mar 23, 2018, 5:25:27 AM3/23/18
to AdWords Scripts Forum
Hello "unknown",

Maybe you can use the solution I'm using for several years now?! For ease of use I've created a post on my website to describe how the script works and how to set it up. 


Is this what you were looking for?

@Thea: is it ok if I post the link to the script here?

Greetings, Martijn

Thea Vega (AdWords Scripts Team)

unread,
Mar 26, 2018, 1:23:48 AM3/26/18
to AdWords Scripts Forum
Hi Martijn,

Yes, you may. Thanks for the information!

dstep...@resolutionmedia.com

unread,
Mar 28, 2018, 4:38:14 AM3/28/18
to AdWords Scripts Forum
Dear Martijn,
Many thanks for posting this script and for your blog post. It is fantastic!

I have been trying to implement it in my accounts; it has generated some Negative Keyword Lists in the Shared Library but it has not applied them to any Campaigns.

What do you think I'm doing wrong?

My naming convention for Exact match campaigns ends in -Exact and the BMM campaigns end in -BMM

Many thanks,
Daniel

Martijn Kraan

unread,
Mar 28, 2018, 5:07:30 AM3/28/18
to adwords-scripts+APn2wQe2bsEEWSFd...@googlegroups.com
Hi Daniel,

Does you identifier on line 8 look like this?


Furthermore, the list is only applied to active campaigns. Are your (BMM) campaigns active?

Greetings,


Met vriendelijke groet,

--
-- 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 "AdWords Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/rELuvmjW6ZM/unsubscribe.
To unsubscribe from this group and all its topics, 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/bfda95d6-95c1-43f3-bd2d-c9a03c18f191%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Stephenson

unread,
Mar 28, 2018, 5:22:06 AM3/28/18
to AdWords Scripts Forum on behalf of Martijn Kraan

Thanks for the very quick reply!

 

Yes, I have done that. Here is an example of 2 campaigns that are both active:

 

Exact match version:

Local-All-GS-UK-P-Defensive-House-General-Exact

 

BMM version:

Local-All-GS-UK-P-Defensive-House-General-BMM

 

I set the identifier on line as ‘BMM’ and I also tried ‘-BMM’ but the script did not add keywords to any campaigns. It has created some NKLs but has not applied any!

 

I would have expected to see all the [exact match keywords] in the Exact campaign be applied as a NKL against the BMM campaign,

 

Many thanks,

Daniel

--

To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.

 

--

-- 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 "AdWords Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/CANcgm75PC0hp-25Sy9yS_FapWk4xi%2Bs4JzgH9Zo9Q%2B3zctURpA%40mail.gmail.com.

Martijn Kraan

unread,
Mar 28, 2018, 4:32:02 PM3/28/18
to AdWords Scripts Forum
Hi Daniel,

Unfortunately, I can't reproduce the error: I've used the identifier mentioned earlier and ran the script on my test account. See the result below:


Is it may be possible for me to get access to your account (temporarily of course) so I can debug the script?

PS: the name of the exact match campaign is irrelevant: the script takes all the exact match keywords into account, regardless in which campaign they are.

Met vriendelijke groet,

--

To unsubscribe from this group and all its topics, send an email to adwords-scripts+unsubscribe@googlegroups.com.

--
-- 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 "AdWords Scripts Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scripts+unsubscribe@googlegroups.com.

--
-- 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 "AdWords Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/rELuvmjW6ZM/unsubscribe.

Anthony Madrigal

unread,
Mar 28, 2018, 4:49:49 PM3/28/18
to AdWords Scripts Forum
Hi Daniel,

If you'd like me to look at your script to see what the issue is, please reply privately to author your CID and script name so that I can take a look.

Regards,
Anthony
AdWords Scripts Team

--

To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.

--
-- 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 "AdWords Scripts Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.

--
-- 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 "AdWords Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/rELuvmjW6ZM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.

Daniel Stephenson

unread,
Mar 29, 2018, 4:21:07 AM3/29/18
to AdWords Scripts Forum on behalf of Martijn Kraan

Hi Martijn,

 

That’s very good of you, thank you. Unfortunately as I work in an agency, I’m not allowed to give any external parties access to the account. I’m sure you understand.

 

I also received the same result as you achieved which is great – the NKL was created but just not applied to the Exact match campaigns.

 

I’ll have to try again and find out why it hasn’t happened.

 

Kind regards,

Daniel

 

From: AdWords Scripts Forum on behalf of Martijn Kraan <adwords...@googlegroups.com>
Sent: 28 March 2018 10:30
To: AdWords Scripts Forum <adwords...@googlegroups.com>
Subject: Re: Auto add Exact match keywords as Negatives to BMM campaigns

 

Hi Daniel,

 

Unfortunately, I can't reproduce the error: I've used the identifier mentioned earlier and ran the script on my test account. See the result below:

--

To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.

--
-- 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 "AdWords Scripts Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.

--

-- 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 "AdWords Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/rELuvmjW6ZM/unsubscribe.

To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.

 

--

-- 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 "AdWords Scripts Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/CANcgm77%2BVUzVGDKpVkZZ_YkhmY_Nc7N8NhFpE63kKq-Q9r1q_g%40mail.gmail.com.

Anthony Madrigal

unread,
Mar 29, 2018, 2:29:53 PM3/29/18
to AdWords Scripts Forum
Hi Daniel,

I can take a look your script you if you'd like. If you do, please reply privately to author your CID and script name.

Regards,
Anthony
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages