AdWords
5.1K members online now
5.1K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Email Campaign Report without download link

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I need to schedule an email for a daily Adwords Campaign report which I then need to forward it to another person. However, on using the Email and Schedule option, I get a link where the download is stored and this person might not have access to the account, hence will not be able to download the report.

 

Is there a way, maybe a script or something which will directly send me the raw campaign file to my email every day?

 

Thanks,

2 Expert replyverified_user

Re: Email Campaign Report without download link

Top Contributor
# 2
Top Contributor

Hi anuraagk,

 

I think Scripts would be your best bet here; you could use a script in two ways, depending upon how much detail you want and/or how you want it to look.  You could create an email directly and have the script send that out, or you could have the script write to a shared Google spreadsheet, to which you could give permission for the intended recipient.

 

Check out this example from the Google scripts library to give you an idea of what's possible:

 

https://developers.google.com/adwords/scripts/docs/solutions/account-summary

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Email Campaign Report without download link

Top Contributor
# 3
Top Contributor
Hi Anuraagk,

Depending on the exact data you're looking for, Google Analytics may also be an option. The reports are very flexible, can be scheduled and will attach a csv file to your emails.

-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.’

Re: Email Campaign Report without download link

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
I just need the report to show the campaign name and cost accrued every day, nothing else. But it has to be segmented by campaign which the Account Summary script does not do. How could I do it?

Re: Email Campaign Report without download link

Top Contributor
# 5
Top Contributor

Hi anuraagk, if you can wait until tomorrow, I'll post what you need, it's relatively simple.

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Email Campaign Report without download link

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
That sounds awesome. Thank you so much. I can wait until tomorrow

Re: Email Campaign Report without download link

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Hi Jon,

I looked up some posts and I found a code close enough. I also want to add the date and ensure that the list of campaigns get appended to the previous ones and that they are not over-written.

The code that I have right now over-writes on top of the one present and does not mention the date. How could I modify it?

The code is :

var SPREADSHEET_URL = "The Spreadsheet URL";

function main() {
//These names are important. change them with caution
var tabs = ['camp_perf_yesterday'];
for(var i in tabs) {
var results = runQuery(tabs[i]);
writeToSpreadsheet(tabs[i],results);
}
}

//Helper function to get or create the spreadsheet
function getSheet(tab) {
var s_sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var sheet;
try {
sheet = s_sheet.getSheetByName(tab);
if(!sheet) {
sheet = s_sheet.insertSheet(tab, 0);
}
} catch(e) {
sheet = s_sheet.insertSheet(tab, 0);
}
return sheet
}

//Function to write the rows of the report to the sheet
function writeToSpreadsheet(tab,rows) {
var to_write = convertRowsToSpreadsheetRows(tab,rows);
var s_sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var sheet = getSheet(tab);
sheet.clear();

var numRows = sheet.getMaxRows();
if(numRows < to_write.length) {
sheet.insertRows(1,to_write.length-numRows);
}
var range = sheet.getRange(1,1,to_write.length,to_write[0].length);
range.setValues(to_write);
}

//A generic function used to build and run the report query
function runQuery(tab) {
var API_VERSION = { includeZeroImpressions : false };
var cols = getColumns(tab);
var report = getReport(tab);
var date_range = getDateRange(tab);
var where = getWhereClause(tab);
var query = ['select',cols.join(','),'from',report,where,'during',date_range].join(' ');
var report_iter = AdWordsApp.report(query, API_VERSION).rows();
var rows = [];
while(report_iter.hasNext()) {
rows.push(report_iter.next());
}
return rows;
}

//This function will convert row data into a format easily pushed into a spreadsheet
function convertRowsToSpreadsheetRows(tab,rows) {
var cols = getColumns(tab);
var ret_val = [cols];
for(var i in rows) {
var r = rows[i];
var ss_row = [];
for(var x in cols) {
ss_row.push(r[cols[x]]);
}
ret_val.push(ss_row);
}
return ret_val;
}

//Based on the tab name, this returns the report type to use for the query
function getReport(tab) {
if(tab.indexOf('camp_') == 0) {
return 'CAMPAIGN_PERFORMANCE_REPORT';
}
if(tab.indexOf('keyword_') == 0) {
return 'KEYWORDS_PERFORMANCE_REPORT';
}
throw new Exception('tab name not recognized: '+tab);
}

//Based on the tab name, this returns the where clause for the query
function getWhereClause(tab) {
if(tab.indexOf('camp_') == 0) {
return 'where CampaignStatus = ENABLED';
}
if(tab.indexOf('keyword_') == 0) {
return 'where CampaignStatus = ENABLED and AdGroupStatus = ENABLED and Status = ENABLED';
}
throw new Exception('tab name not recognized: '+tab);
}

//Based on the tab name, this returns the columns to add into the report
function getColumns(tab) {
var ret_array = [];
if(tab.indexOf('daily') >= 0) {
ret_array.push('Date');
}
ret_array.push('CampaignName');
ret_array.push('CampaignStatus');

if(tab.indexOf('keyword_') == 0) {
ret_array = ret_array.concat(['AdGroupName',
'AdGroupStatus',
'Id',
'KeywordText',
'KeywordMatchType']);
}
return ret_array.concat(['Cost']);

}

//Based on the tab name, this returns the date range for the data.
function getDateRange(tab) {
if(tab.indexOf('yesterday') >= 0) {
return 'YESTERDAY';
}

}