examples/AdWords/v201809/AdvancedOperations/AddDynamicPageFeed.php
private static function createDsaUrlAddOperation(
        DSAFeedDetails $feedDetails,
        $url,
        $labelName
    ) {
        // Create the FeedItemAttributeValues for the URL and label.
        $urlAttributeValue = new FeedItemAttributeValue();
        $urlAttributeValue->setFeedAttributeId($feedDetails->urlAttributeId);

        // See https://support.google.com/adwords/answer/7166527 for page feed
        // URL recommendations and rules.
        $urlAttributeValue->setStringValues([$url]);

        $labelAttributeValue = new FeedItemAttributeValue();
        $labelAttributeValue->setFeedAttributeId(
            $feedDetails->labelAttributeId
        );
        $labelAttributeValue->setStringValues([$labelName]);

        // Create the feed item.
        $feedItem = new FeedItem();
        $feedItem->setFeedId($feedDetails->feedId);
        $feedItem->setAttributeValues([$urlAttributeValue, $labelAttributeValue]);

        // Create the feed item operation.
        $operation = new FeedItemOperation();
        $operation->setOperand($feedItem);
        $operation->setOperator(Operator::ADD);

        return $operation;
    }
private static function createDsaUrlAddOperation(
        DSAFeedDetails $feedDetails,
        $url,
        $labelName
    ) {
        // Create the FeedItemAttributeValues for the URL and label.
        $urlAttributeValue = new FeedItemAttributeValue();
        $urlAttributeValue->setFeedAttributeId($feedDetails->urlAttributeId);

        // See https://support.google.com/adwords/answer/7166527 for page feed
        // URL recommendations and rules.
        $urlAttributeValue->setStringValues([$url]);

        $labelAttributeValue = new FeedItemAttributeValue();
        $labelAttributeValue->setFeedAttributeId(
            $feedDetails->labelAttributeId
        );
        $labelAttributeValue->setStringValues([$labelName]);

        // Create the feed item.
        $feedItem = new FeedItem();
        $feedItem->setFeedId($feedDetails->feedId);
        $feedItem->setAttributeValues([$urlAttributeValue, $labelAttributeValue]);

        // Create the feed item operation.
        $operation = new FeedItemOperation();
        $operation->setOperand($feedItem);
        $operation->setOperator(Operator::ADD);

        return $operation;
    }
private static function createDsaUrlAddOperation ( DSAFeedDetails $ feedDetails , $ url , $ labelName ) { // Create the FeedItemAttributeValues for the URL and label. $ urlAttributeValue = new FeedItemAttributeValue ( ) ; $ urlAttributeValue -> setFeedAttributeId ( $ feedDetails -> urlAttributeId ) ; // See https://support.google.com/adwords/answer/7166527 for page feed // URL recommendations and rules. $ urlAttributeValue -> setStringValues ( [ $ url ] ) ; $ labelAttributeValue = new FeedItemAttributeValue ( ) ; $ labelAttributeValue -> setFeedAttributeId ( $ feedDetails -> labelAttributeId ) ; $ labelAttributeValue -> setStringValues ( [ $ labelName ] ) ; // Create the feed item. $ feedItem = new FeedItem ( ) ; $ feedItem -> setFeedId ( $ feedDetails -> feedId ) ; $ feedItem -> setAttributeValues ( [ $ urlAttributeValue , $ labelAttributeValue ] ) ; // Create the feed item operation. $ operation = new FeedItemOperation ( ) ; $ operation -> setOperand ( $ feedItem ) ; $ operation -> setOperator ( Operator :: ADD ) ; return $ operation ; }
Creates a feed item operation to add the DSA URL.
Creates a feed item operation to add the DSA URL .