【问题标题】:Manage Google Adwords Feeds by using AdWords API (PHP Client Library)使用 AdWords API(PHP 客户端库)管理 Google Adwords Feed
【发布时间】:2015-08-25 12:59:15
【问题描述】:

如何使用 AdWords Api 的 php 客户端库在 Google AdWords 中管理我的提要?我需要更改某些提要项目中的数据,但我在 php 中找不到合适的代码示例如何做到这一点。 有人可以帮助我吗?提前致谢。

【问题讨论】:

    标签: google-ads-api


    【解决方案1】:

    PHP 代码本身的文档中提供了示例,这是在给定提要中添加 feedItems 的示例: https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201506/Extensions/AddSitelinksUsingFeeds.php

    更新时,请确保使用“SET”运算符而不是“ADD”。

    基本上,您想要做的事情如下:

    foreach ($feedData as $data) {
        $feedItemClass = new \FeedItem();
        $feedItemClass->attributeValues = [
            // INT64, refer to (1) for more info
            new FeedItemAttributeValue(1, (int)$data['id']),
            // StringValues
            new FeedItemAttributeValue(2, null, null, null, null, null, null, null, $data['urlLangs']),
            // String
            new FeedItemAttributeValue(3, null, null, null, $data['name']),
            new FeedItemAttributeValue(4, null, null, null, $data['imageUrl']),
            new FeedItemAttributeValue(5, null, null, null, $data['price']),
        ];
    
        $feedItemClassOperation = new FeedItemOperation();
        $feedItemClassOperation->operator = $operator;
        $feedItemClassOperation->operand = $feedItemClass;
    
        $allOperations[] = $feedItemClassOperation;
    }
    
    if (!empty($allOperations)) {
        // Perform all operations at once
        $feedItemService->mutate($allOperations);
    }
    

    (1):https://developers.google.com/adwords/api/docs/reference/v201506/FeedService.FeedAttribute

    您好。

    【讨论】:

      猜你喜欢
      • 2017-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多