AdWords
5K members online now
5K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

Need custom date range in AdWords Script for reporting

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all,

I'm writing a small script to pull yearly campaign data. I had the report set up to show "Last_30_days". However, I now need it to be all year. I can't find how to add a customer date range to a campaign performance report in AdWords scripts.

 

Thanks.

 

Script below:

 

 

var LIMIT1 = "Impressions > 0";
var REPORT_TYPE = "CAMPAIGN_PERFORMANCE_REPORT";
var Duration = ("20170101", "20171231");
var COLUMNS = ['CampaignName',
'Cost',
'AccountDescriptiveName' ,
'AllConversions' ,
'AllConversionValue' ,
'CampaignName' ,
'ClickAssistedConversions' ,
'ClickAssistedConversionValue' ,
'Clicks' ,
'Cost' ,
'Week' ,
'Labels' ,
'Impressions' ,
];

function main() {
var spreadsheet = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1wi2CSYIVm7R1VqYp8x3ocis0IrBwNyYSQDCpOrYQCGQ/edit#gid=0")
var URL = spreadsheet.getUrl();

var columnsStr = COLUMNS.join(',') + " ";

var report = AdWordsApp.report(
'SELECT ' + columnsStr +
'FROM ' + REPORT_TYPE + ' ' +
'WHERE ' + LIMIT1 + ' ' +
'DURING ' + Duration);

report.exportToSheet(spreadsheet.getActiveSheet());

Logger.log("Your Report Was Created: " + URL);
}

1 Expert replyverified_user

Need custom date range in AdWords Script for reporting

Top Contributor
# 2
Top Contributor

Hi @John-Magnus R,

 

Check out forDateRange here:  https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_campaignselector

 

-Tommy

Tommy Sands, AdWords Top Contributor | Community Profile | Twitter | Philly Marketing Labs
Did you find any helpful responses or answers to your query? If yes, please mark it as the ‘Best Answer.’