Detect duplicate keywords with this AdWords Script!

What it does:

  1. Load the Keyword Performance Report
  2. Find duplicate Keywords across Campaigns and AdGroups (Draft and Experiments have to be excluded)
  3. Label the duplicate Keywords

But first one step back: Why duplicate Keywords can happen?

I often see this in accounts that are already running for a long time and are often managed by different people that are also changing over time. The process of adding keywords will also look a little bit different over time – and suddenly here they are: duplicate keywords.
In other cases product feeds are used to build thousands of keywords in an automated process – but the feed quality isn’t perfect in most of the cases and it’s possible that the result are duplicate keywords. In that case you have to find them quickly an make them unique somehow by adding describing words.

AdWords Script to the rescue: Labeling the duplicate Keywords for further actions

// SEAlyzer:Labeler:DuplicateKeywords
// Author: Stefan Neefischer (neefi@sealyzer.com)

var keywordcount = []
var duplicates = []

function main() {
  labelname = "SEAlyzer_DuplicateKeyword"
  	// Add your label by hand or uncomment the next line once
  	// AdWordsApp.createLabel(labelname);
  fetchAwqlReport()
  	for (var d in duplicates) {
    	setLabel(d,labelname)
    } 
}

function setLabel(keywordid,labelname) {
  var keywordIterator = AdWordsApp.keywords().withCondition('LabelNames CONTAINS_NONE ["'+labelname+'"]').withCondition('Id = '+ keywordid).withCondition('Status = "ENABLED"').get();
  	while (keywordIterator.hasNext()) {
    	var keyword = keywordIterator.next()
       	keyword.applyLabel(labelname)
    }
}

  
function fetchAwqlReport() {
  report = AdWordsApp.report("SELECT Id, Criteria FROM KEYWORDS_PERFORMANCE_REPORT WHERE Status = 'ENABLED'")
  	var rows = report.rows()
  while (rows.hasNext()) {
    	var row = rows.next()
    	var id = row["Id"]
      	var keyword = row["Criteria"]
        if (!keywordcount[id]) {
        	keywordcount[id] = id
        }
      	else {
        	duplicates[id] = 1
        } 	
  }
}

More Similar Posts

Menu