Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
Add campaigns and its keywords into array

I'm trying to export keywords and campaigns from my Google Ads with the following conditions:

  • clicks > 10
  • conversions = 0
  • date range = This Month

Here is the code:

function main() {

  var spreadsheetUrl = 'FINAL URL';
  var spreadsheet = SpreadsheetApp.openByUrl(spreadsheetUrl);
  var ss = spreadsheet.getSheetByName('Sheet1');
  ss.clear();

  var sheetarray = [
    ['keyword', 'campaign name', 'clicks', 'conversions']
  ];

  var keywords = AdsApp.keywords()
    .withCondition("Clicks > 10")
    .withCondition("Conversions = 0")
    .forDateRange("THIS_MONTH")
    .get();

  var campaigns = AdsApp.campaigns()
    .get();

  while (keywords.hasNext()) {
    var keyword = keywords.next();
    var campaign = campaigns.next();
    sheetarray.push([
      keyword.getText(),
      campaign.getName(),
      keyword.getStatsFor("THIS_MONTH").getClicks(),
      keyword.getStatsFor("THIS_MONTH").getConversions()
    ]);
  }

The issue I am having is that the campaigns are not the ones the keywords are in.

Can anyone help?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!