How to get Search Keywords List

8 views
Skip to first unread message

Avnish Sharma

unread,
Aug 21, 2019, 8:58:56 AM8/21/19
to Google Ads Scripts Forum
Hi All,

I need to know how we get all search Keywords list using AdsApp. I used this code

var SearchKeywords = AdsApp.keywords().withCondition("Status = ENABLED").forDateRange("YESTERDAY").orderBy("Impressions DESC").get();

But when I used this query to fetch all Search Keywords it got the all keywords around ( 2 lac keywords ), But when I manually check then I got the only ( 37000 ) keywords. So I need to know how we get only Search Keywords using Script codes.

If any one know then Please help me. Thanks 
  

Google Ads Scripts Forum Advisor Prod

unread,
Aug 21, 2019, 3:15:01 PM8/21/19
to adwords-scripts+apn2wqfctjdoumhx...@googlegroups.com, adwords-scripts+apn2wqfctjdoumhx...@googlegroups.co, adwords...@googlegroups.com
Hi Avnish,

To retrieve all keywords that belong to search campaigns, you will have to go through a campaign iterator first, using the AdvertisingChannelType attribute. For example,

function main() {

  var searchCampaigns = AdsApp.campaigns().withCondition("AdvertisingChannelType = 'SEARCH'").get();
  
  while(searchCampaigns.hasNext()) {
    var keywords = AdsApp.keywords().withCondition("Status = ENABLED").forDateRange("YESTERDAY").orderBy("Impressions DESC").get();
 
  while(keywords.hasNext()) {
      // do work here
    }
  }
}

Regards,
Matt
Google Ads Scripts Team

ref:_00D1U1174p._5001UHEE7D:ref
Reply all
Reply to author
Forward
0 new messages