Google Ads Scripts - Send Logger.log content to email?
I have a script that shows 10 most clicked keywords, their average CPC and conversions. While previewing the script it works fine. But when I send it to my email, only last row of the 10 rows shows. What is wrong here?
function main() { var keywords = AdsApp.keywords() .orderBy("Clicks DESC") // .orderBy("Impressions DESC") .forDateRange("THIS_MONTH") .withLimit(10) .get(); Logger.log("10 most clicked keywords"); while (keywords.hasNext()) { var keyword = keywords.next(); content = keyword.getText() + " | Clicks: " + keyword.getStatsFor("THIS_MONTH").getClicks() + " | CPC: " + keyword.getStatsFor("THIS_MONTH").getAverageCpc().toFixed(2) + " | Conversions: " + keyword.getStatsFor("THIS_MONTH").getConversions(); } MailApp.sendEmail({ to: 'myemail@myemail.com', subject: "10 most clicked keywords", htmlBody: content }); }