doujiang2812 2014-12-19 04:41 采纳率: 0%
浏览 32
已采纳

当gclid存在时,必需的gclid错误

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.

  • 写回答

1条回答 默认 最新

  • dtwncxs3547 2014-12-21 03:48
    关注

    I think you have used wrong field name. You have used ID in capital.

    try this

    $feed = new OfflineConversionFeed();

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

    instead of:

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

    may be it fixes the issue..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比