Manage Google Adwords Feeds by using AdWords API (PHP Client Library)

How I can manage my feed in Google AdWords using php client lib of AdWords Api? I need to change data in some feed items but I can't find appropriate code examples in php how to do it. Can somebody help me? Thanks in advance.


Examples are available in the documentation of the PHP code itself, here's one that add feedItems in a given feed: https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201506/Extensions/AddSitelinksUsingFeeds.php

When you are updating, make sure you use the "SET" operator instead of "ADD".

Basically, what you want to do is the following:

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

Greetings.

链接地址: http://www.djcxy.com/p/32374.html

上一篇: AdSense允许在社交网站上使用

下一篇: 使用AdWords API(PHP客户端库)管理Google Adwords Feed