Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdWords import fails on empty report #49

Open
toubsen opened this issue Oct 25, 2018 · 0 comments
Open

AdWords import fails on empty report #49

toubsen opened this issue Oct 25, 2018 · 0 comments

Comments

@toubsen
Copy link

toubsen commented Oct 25, 2018

I tried to import data for the last days via the following cron call:

php ./console aom:import --platform=AdWords --startDate=2018-10-01 --endDate=2018-10-24

It failed with the following output + error:

[2018-10-25 08:39:23] aom.INFO: Starting import of AdWords account xxx for date 2018-10-01 now. {"platform":"AdWords","task":"import"} []
[2018-10-25 08:39:23] aom.DEBUG: Deleted existing AdWords data (0.000428s for 0 imported data records). {"platform":"AdWords","task":"import"} []
[2018-10-25 08:39:23] aom.DEBUG: Deleted existing AdWords gclid-data (0 records). {"platform":"AdWords","task":"import"} []

  [Zend_Db_Statement_Exception]
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at
  line 1

  [PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at
  line 1

Base reason for this was: Configuring an AdWords account for a campaign, which was not running (yet), so the report was empty.

Example dumped report data:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<report>
	<report-name name='CRITERIA_PERFORMANCE_REPORT'/>
	<date-range date='Oct 1, 2018'/>
	<table>
		<columns>
			<column name='account' display='Account'/>
			<column name='currency' display='Currency'/>
			<column name='timeZone' display='Time zone'/>
			<column name='campaignID' display='Campaign ID'/>
			<column name='campaign' display='Campaign'/>
			<column name='adGroupID' display='Ad group ID'/>
			<column name='adGroup' display='Ad group'/>
			<column name='keywordID' display='Keyword ID'/>
			<column name='keywordPlacement' display='Keyword / Placement'/>
			<column name='criteriaType' display='Criteria Type'/>
			<column name='network' display='Network'/>
			<column name='networkWithSearchPartners' display='Network (with search partners)'/>
			<column name='avgPosition' display='Avg. position'/>
			<column name='conversions' display='Conversions'/>
			<column name='qualityScore' display='Quality score'/>
			<column name='maxCPC' display='Max. CPC'/>
			<column name='impressions' display='Impressions'/>
			<column name='clicks' display='Clicks'/>
			<column name='gmailClicksToWebsite' display='Gmail clicks to website'/>
			<column name='cost' display='Cost'/>
			<column name='day' display='Day'/>
		</columns>
	</table>
</report>

The subsequent processing int this cron job will then produce only empty arrays and pass it into the DB insert statment. This will obviously will fail, as there's no data to replace the placeholder in the query string.

$result = Db::query(
'INSERT INTO ' . DatabaseHelperService::getTableNameByPlatformName(AOM::PLATFORM_AD_WORDS)
. ' (' . implode(', ', $columns) . ') VALUES ' . $allPlaces,
$dataToInsert
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant