Exclude exact in DSA campaign

Automatically exclude all exact keywords in DSA campaigns. Search traffic will land in the most relevant adgroup.

Start Now!
Exclude exact-match keywords in DSA
Exclude Get started!

Do you use DSA campaigns? You may be using DSA for keywordmining or to increase your impressions. If you have separate DSA campaigns in your account, it is recommended to exclude all search terms that you already advertise on. Then your campaigns do not compete with each other and the searchterms enter the adgroup with the most relevant advertisements.

This script helps you with this and is easy to use. It automatically adds all exact-match keywords as a negative keyword in your DSA campaign(s).

Note: if you interrupt a 'regular' campaign, the keywords from this campaign will still be excluded in your DSA campaign. If you still want to be found on these keywords, you have to remove the negative keywords manually.

Settings

  • LOG: Specify whether the script should report the intermediate steps, by adjusting the value to 'true'.
  • EXACT_MATCH_CAMPAIGN_NAME: Enter (part of) the campaign names for which you want to exclude the exact search terms in the DSA campaign.
  • DSA_CAMPAIGN_NAME: Enter (part of) the campaign name of your DSA campaign(s).
The script
// Copyright 2020. Increase BV. All Rights Reserved.
// Not to be used without permission of the creator or Increase B.V.
//
// Created By: Tibbe van Asten
// for Increase B.V.
// 
// Created: 01-10-2019
// Last update: 26-06-2020
//
// ABOUT THE SCRIPT
// This script will help the Slimster accounts kept clean. 
// Exact match keywords will be excluded in the DSA campaign.
//
////////////////////////////////////////////////////////////////////

var config = {
  
  // Set LOG to true to check for errors. Once this script runs
  // smootly, set to false to improve script performance.
  LOG : true,

  // Identify the campaigns with exact match keywords by campaignname.
  EXACT_MATCH_CAMPAIGN_NAME : "[NB]",
  
  // Identify the DSA campaign by campaignname.
  DSA_CAMPAIGN_NAME : "DSA"
  
}

////////////////////////////////////////////////////////////////////

function main(){
  
  var keywordsToBeExcluded = [];
  
  // We'll select all exact match keywords
  var keywordIterator = AdsApp
    .keywords()
    .withCondition("CampaignName CONTAINS '"+config.EXACT_MATCH_CAMPAIGN_NAME+"'")
    .withCondition("KeywordMatchType = EXACT")
    .get();
  
  while(keywordIterator.hasNext()){
    var keyword = keywordIterator.next();
    keywordsToBeExcluded.push(keyword.getText());
  } // keywordIterator
  
  // Now we select the DSA campaign(s) and exclude every keyword
  var campaignIterator = AdsApp
    .campaigns()
    .withCondition("Name CONTAINS '"+config.DSA_CAMPAIGN_NAME+"'")
    .withCondition("Status = ENABLED")
    .get();
  
  while(campaignIterator.hasNext()){
    var campaign = campaignIterator.next();
    
    for(var i = 0;i < keywordsToBeExcluded.length;i++){
      campaign.createNegativeKeyword(keywordsToBeExcluded[i].toLowerCase());
      
        if(config.LOG === true){
          Logger.log("Excluded "+keywordsToBeExcluded[i].toLowerCase()+" in "+campaign.getName());  
        }
    } // negative keyword iterator
                                     
  } // campaignIterator
  
  Logger.log("Thanks for using this custom script by Tibbe van Asten. Winning!")
  
} // function main()
Show whole script!
The Experts
Tibbe van Asten Head of PPC @ Increase
Nils Rooijmans Water Cooler Topics
Martijn Kraan Freelance PPC Specialist
Bas Baudoin Teamlead SEA @ Happy Leads
How about you? JOIN US!
Sharing Knowledge
Caring

Sharing Knowledge

Adsscripts.com is all about sharing knowledge. In the current market, PPC specialists like to keep their knowledge and experience to themselves. We're convinced that sharing knowledge can ensure that everyone gets better at their work. We want to change this by sharing our knowledge about scripts with everyone.

Do you also want to contribute? We are open to new ideas and feedback on everything you find on Adsscripts.com.

Contact us

Training &
Workshop
Contact us!
Adsscripts Training & Workshop