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]);
}
}
}
}
--
-- 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.
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.
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.
--
-- 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 |
--
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.
--
-- 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/CANcgm75PC0hp-25Sy9yS_FapWk4xi%2Bs4JzgH9Zo9Q%2B3zctURpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
-- 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/AM2PR08MB0500EEA3B9208E4E1D872603B8A30%40AM2PR08MB0500.eurprd08.prod.outlook.com.
--
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/bfda95d6-95c1-43f3-bd2d-c9a03c18f191%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
-- 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.
For more options, visit https://groups.google.com/d/optout.
--
-- 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.
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.
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.
--
-- 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.
For more options, visit https://groups.google.com/d/optout.
--
-- 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/AM2PR08MB0500EEA3B9208E4E1D872603B8A30%40AM2PR08MB0500.eurprd08.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
--
-- 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.