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

Script Returns Inaccurate Conversions Data

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi Everyone,

 

When comparing the results of my script to the AdWords dashboard or a report downloaded from the reports section, Clicks, Impressions, and Cost are correct. Conversions, however, shows 11 on my script instead of 32. I can't seem to figure out why. Any help is appreciated.

 

 

function main() { 

	var REPORT_NAME = 'AdWords Ad Performance Report (Recent)'; 

	if(DriveApp.getFilesByName(REPORT_NAME).hasNext()){ 
		var file = DriveApp.getFilesByName(REPORT_NAME).next(); 
		var spreadSheet = SpreadsheetApp.openByUrl(file.getUrl()); 
	} else { 
		var spreadSheet = SpreadsheetApp.create(REPORT_NAME); 
	} 

	var adwordsSheet = spreadSheet.getActiveSheet();
		Logger.log("1. Sheet Set");
	var REPORT_TYPE = 'AD_PERFORMANCE_REPORT';
	var FILTER = 'Impressions > 0';

   var newDate = new Date();
  
   var yesterday = new Date();
   yesterday.setDate(newDate.getDate() - 1); // If in Asia or Australia, remove "- 1" for best results.
   var endDay = ("0" + yesterday.getDate()).slice(-2);
   var endMonth = ("0" + (yesterday.getMonth() + 1)).slice(-2);
   var endYear = yesterday.getFullYear();

   var weekAgo = new Date();
   weekAgo.setDate(newDate.getDate() - 7); // If in Asia or Australia, change "7" to "6" for best results.
   var startDay = ("0" + weekAgo.getDate()).slice(-2);
   var startMonth = ("0" + (weekAgo.getMonth() + 1)).slice(-2);
   var startYear = weekAgo.getFullYear();

   var DATE_RANGE = startYear + startMonth + startDay + ',' + endYear + endMonth + endDay;
	var COLUMN_NAMES = [
		'AdGroupName',
		'AdType',
		'CampaignName',
		'Description',
		'Description1',
		'Description2',
		'Headline',
		'HeadlinePart1',
		'HeadlinePart2',
		'Id',
		'ImageAdUrl',
		'Status',
		'AdNetworkType1',
		'AdNetworkType2',
		'Date',
		'Device',
		'Clicks',
		'Conversions',
		'Cost',
		'Impressions',
		'VideoViews'
	];
	var COLUMNS = COLUMN_NAMES.join(',');
		Logger.log("2. Variables Set");

	var REPORT = AdWordsApp.report(
		'SELECT ' + COLUMNS +
		' FROM ' + REPORT_TYPE +
		' WHERE ' + FILTER +
		' DURING ' + DATE_RANGE
	);
		Logger.log("3. Report Set");

	REPORT.exportToSheet(adwordsSheet);
		Logger.log("4. Script Complete  --  " + (adwordsSheet.getLastRow() - 1) + " rows in sheet");
}
1 Expert replyverified_user

Script Returns Inaccurate Conversions Data

Rising Star
# 2
Rising Star

Hi Tony R,

 

Are there multiple conversion actions in AdWords? If so, is the script pulling all of them?

Sumanth Sridhar