AdWords script for adding exact match keywords as negatives to BMM/MBM campaigns

A lot of SEA-consultants split their keywords into campaigns with only exact match keywords and campaigns with only modified broad match keywords. The Alpha Beta structure also needs that exact match keywords are excluded in the bmm or mbm campaigns. To keep things accurate, up to date and easy to manage I’ve created a script to do this for you. It’s called: NKL refresh!

Script for excluding exact keywords in bmm campaigns

Some assumptions

Before we start with the outline of the script, first some notes to make sure we’re on the same line :).

  • This script uses negative keyword lists to keep things organized. I’ve abbreviated them to “NKL”.
  • An exact match keyword should be excluded from all other bmm keywords. It doesn’t matter if it’s the direct counterpart (e.g. excluding [cars] on +cars) or some keyword that’s completely off (e.g. excluding [cars] on +flowers). If an exact match keyword is somewhere in the account, it should be only matched there, not anywhere else.

How it works – First run

The script follows a few simple steps to exclude all the exact match keywords in the account to all the bmm campaigns.

1. Get exact match keywords

Get all the exact match keywords in the account with these conditions: Campaign status = enabled, Ad group status = enabled and status (of keyword) = enabled.
The keywords will be stored in a list and are deduplicated.

2. Create one (or more) negative keyword List(s)

For every 5000 keywords, create a negative keyword list (NKL) in the Shared Library. The lists will be named “Exact 1″, Exact 2”, etc.

3. Add all exact match keywords to the NKL(s)

The third step is to add all the exact keywords found in step 1 to the NKL’s.

4. Apply the NKL(s) to all BMM & DSA campaigns

The last step is to apply the NKL’s to the BMM campaigns. I’ve also added the functionality to include DSA campaigns.

How it works – Every next run

The repeat runs of the script work a bit different. Since the NKL’s are already created, it’s not needed to do that again. However, it checks if an extra list is needed because for example the amount of exact keywords has grown to 5001 instead of 4999.

Note: the script is capable of creating extra lists (if needed) but not deleting lists. When a NKL is not needed anymore, and thus empty, it will log this message “Remove any empty Negative Keyword Lists in the account <account name>”.

Furthermore, everytime the script runs it first empties the lists and then populates them again with the active keywords. This way the lists stay up-to-date and only actual active keywords are excluded. If you pause bad performing keywords, you should add them to another NKL yourself (e.g. list “Bad performing keywords”).

Configuration

It’s very simple to “configure” the script. Just fill in the 3 variables on lines 8-10, schedule the script to run daily and you’re good to go!

The bmm identifier is a unique part in your campaign name which ables the script to identify what campaigns to use. So in the script below a campaign name that would match the criteria could be “Campaign ABC (mbm)”. If you campaign is called “Campaign ABC – BMM” just change the indentifier in line 8 to ‘ – BMM’.

Good luck and if you have any question, please leave a comment!

7 thoughts on “AdWords script for adding exact match keywords as negatives to BMM/MBM campaigns

  1. Marc Schurman

    Hi Martijn,

    Topscript dit! complimenten.
    Het komt bij mij ook wel eens voor dat ik de MBM & Exact verdeling binnen een campagne maak, dus dat het script eigenlijk naar de MBM adgroups moet kijken. Alleen dan loop je tegen ‘t probleem dat je geen NKL’s op adgroup kunt toewijzen. Heb jij toevallig niet een scriptje liggen die alleen de exacte varianten binnen campagne X aan de MBM adgroups binnen die campagne X toegevoegt. (om te voorkomen dat elke adgroup helemaal wordt volgestopt :-))

    Ben benieuwd!

    Groet,

    Marc

  2. Del

    When running this script I’m getting an error
    “Cannot fetch more AdWords entities from iterator: exceeded limit of 50000.”

    Any thoughts how to resolve?

  3. Svetlana Stefanicki

    Hi there,
    This is a great script. Thank you.
    I’m having a small problem with it- it doesn’t apply negatives to campaigns. I checked the code and everything makes sense. Could you please let me know why I’m encountering this issue?

  4. Monika

    Hi Martijn,

    I just set up the script and it works well! Thanks for this hack 😉

    Best,

    Monika

Comments are closed.