I am trying to upload offline conversions into Google Adwords, but I am encountering an error on the $uploadResult = $conversionService->mutate($operations)
call. The error that I am getting is RequiredError.REQUIRED @ operations[0].operand.conversionGclid
with an identical entry for every operation that I have in the array.
According to the documentation, this error is thrown when a required field is left null, but I know that the field is not null because the following line returns the value:
foreach($opperations as $opp){
print "Value of opp->gclid : " . $opp->operand->googleClickID . "
";
}
I gather the information using a query, and this is my code to process the results:
if($queryResult->rowCount() > 0){
print "Query returned " . $queryResult->rowCount() . " rows
";
$operations = array();
while($row = $queryResult->fetch(PDO::FETCH_ASSOC)){
$feed = new OfflineConversionFeed();
$feed->conversionName = $conversionName;
$feed->conversionTime = $row['conversion_datetime'];
$feed->googleClickID = $row['gclid'];
$operations[] = new OfflineConversionFeedOperation($feed, 'ADD');
}
foreach($opperations as $opp){
print "Value of opp->gclid : " . $opp->operand->googleClickID . "
";
}
//Following line throws error------------
$uploadResult = $conversionService->mutate($operations);
printf('Upload for %s : %s complete', $user->GetClientCustomerId() , $conversionName);
return;
}
printf('No records for %s found', $user->GetClientCustomerId());
Looking over the samples that are found here and here, this should work without any issues, but I am getting the RequiredError
.