Home Kiến ThứcGoogle Ads Xuất Keyword Có Hiệu Suất Thấp Sang Google Sheet – Tập Lệnh Google Ads

Xuất Keyword Có Hiệu Suất Thấp Sang Google Sheet – Tập Lệnh Google Ads

by admin

function main() {

  //Step 1: Connect Google Ads to the Google Sheet

  var spreadsheetUrl = ‘YOUR URL GOES HERE’;

  var spreadsheet = SpreadsheetApp.openByUrl(spreadsheetUrl);

  var ss = spreadsheet.getSheetByName(‘Sheet1’);

  ss.clear();

  //Step 2: Create an array to store the data

  var sheetarray = [[‘keyword’, ‘clicks’, ‘conversions’]];

  //Step 3: Collect the data you need from Google Ads

  var keywords = AdsApp.keywords()

      .withCondition(“Clicks > 20”)

      .withCondition(“Conversions = 0”)

      .forDateRange(“THIS_MONTH”)

      .get();

  //Step 4: Add the data you got from Google Ads into the array

  while (keywords.hasNext()) {

    var keyword = keywords.next();

    sheetarray.push([

        keyword.getText(),

        keyword.getStatsFor(“THIS_MONTH”).getClicks(),

        keyword.getStatsFor(“THIS_MONTH”).getConversions()

      ]);

  }

  //Step 5: Display the contents of the array

  Logger.log(sheetarray);

  if (sheetarray.length > 0) {

 

   // Step 6: Send the array’s data to the Google Sheet

    ss.getRange(1, 1, sheetarray.length, sheetarray[0].length).setValues(sheetarray);

     

    // Step 7: Send email with link to Google Sheet

    MailApp.sendEmail(“INSERT YOUR EMAIL ADDRESS HERE”, “Keywords with ZERO conversions”, “Here’s the link: “+spreadsheetUrl);

  } 

}

 Cần lấy khoảng thời gian nào thì điền ở phần step 3

TODAY

YESTERDAY

LAST_7_DAYS

THIS_WEEK_SUN_TODAY

LAST_WEEK

LAST_14_DAYS

LAST_30_DAYS

LAST_BUSINESS_WEEK

LAST_WEEK_SUN_SAT

THIS_MONTH

LAST_MONTH

ALL_TIME

You may also like

Leave a Comment