Php gclid存在时所需的gclid错误

Php gclid存在时所需的gclid错误,php,google-ads-api,Php,Google Ads Api,我试图将脱机转换上传到Google Adwords中,但在$uploadResult=$conversionService->mutate($operations)调用中遇到错误。我得到的错误是requireError.REQUIRED@operations[0]。操作数.conversionClid,数组中的每个操作都有相同的条目 根据文档,当必填字段保留为null时会引发此错误,但我知道该字段不是null,因为以下行返回值: foreach($opperations as $opp)

我试图将脱机转换上传到Google Adwords中,但在
$uploadResult=$conversionService->mutate($operations)
调用中遇到错误。我得到的错误是
requireError.REQUIRED@operations[0]。操作数.conversionClid
,数组中的每个操作都有相同的条目

根据文档,当必填字段保留为null时会引发此错误,但我知道该字段不是null,因为以下行返回值:

    foreach($opperations as $opp){
        print "Value of opp->gclid : " . $opp->operand->googleClickID . "\n\n";
    }
我使用查询收集信息,这是我处理结果的代码:

if($queryResult->rowCount() > 0){
    print "Query returned " . $queryResult->rowCount() . " rows\n\n";

    $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 . "\n\n";
    }

    //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());

查看找到的示例,这应该可以正常工作,但是我得到了
要求的错误

我认为您使用了错误的字段名。你在首都用过身份证

试试这个

$feed=新的OfflineConversionFeed()

$feed->googleClickId=$row['gclid']

而不是:

$feed->googleClickID=$row['gclid']


可能是它解决了问题。

解决了问题。事实上,我昨天使用了它的构造函数,
newofflineconversionfeed($row['gclid'],$conversionName,$row['conversion\u datetime'])
,但我刚刚尝试了你的答案,它也起了作用。