Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Find all the keywords that match a set of criteria. Those keywords
* will be filtered by the set of eligible keywords.
* It returns a list of AdGroup and Keyword Ids to use in a Selector.
function getDuds(options,eligible_keywords) {
var columns = ['CampaignId',
// Let's add the metric we're using to find the duds
var date_range = [
var query_str = [
].join(' ');
var report =;
var rows = report.rows();
var duds = [];
while (rows.hasNext()) {
var row =;
var key = [row.CampaignId,row.AdGroupId,row.Id].join('-');
// If the keyword isn't eligible, skip it
if(!eligible_keywords[key]) { continue; }
return duds;
// Helper function to build the AWQL filter
function buildFilterClause(options) {
return [options.metric,'<=',options.threshold].join(' ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment