examples/AdWords/v201809/Extensions/AddSitelinksUsingFeeds.php
private static function restrictFeedItemToAdGroup(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $feedId,
        $feedItemId,
        $adGroupId
    ) {
        $feedItemTargetService = $adWordsServices->get(
            $session,
            FeedItemTargetService::class
        );

        // Create a feed item ad group target.
        $feedItemAdGroupTarget = new FeedItemAdGroupTarget();
        $feedItemAdGroupTarget->setFeedId($feedId);
        $feedItemAdGroupTarget->setFeedItemId($feedItemId);
        $feedItemAdGroupTarget->setAdGroupId($adGroupId);

        // Create a feed item ad group target operation.
        $operation = new FeedItemTargetOperation();
        $operation->setOperand($feedItemAdGroupTarget);
        $operation->setOperator(Operator::ADD);

        // Create the feed item ad group target on the server and print out
        // some information.
        $result = $feedItemTargetService->mutate([$operation]);
        $feedItemAdGroupTarget = $result->getValue()[0];
        printf(
            'Feed item target for feed ID %d and feed item ID %d was '
            . 'created to restrict serving to ad group ID %d.%s',
            $feedItemAdGroupTarget->getFeedId(),
            $feedItemAdGroupTarget->getFeedItemId(),
            $feedItemAdGroupTarget->getAdGroupId(),
            PHP_EOL
        );
    }
private static function restrictFeedItemToAdGroup(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $feedId,
        $feedItemId,
        $adGroupId
    ) {
        $feedItemTargetService = $adWordsServices->get(
            $session,
            FeedItemTargetService::class
        );

        // Create a feed item ad group target.
        $feedItemAdGroupTarget = new FeedItemAdGroupTarget();
        $feedItemAdGroupTarget->setFeedId($feedId);
        $feedItemAdGroupTarget->setFeedItemId($feedItemId);
        $feedItemAdGroupTarget->setAdGroupId($adGroupId);

        // Create a feed item ad group target operation.
        $operation = new FeedItemTargetOperation();
        $operation->setOperand($feedItemAdGroupTarget);
        $operation->setOperator(Operator::ADD);

        // Create the feed item ad group target on the server and print out
        // some information.
        $result = $feedItemTargetService->mutate([$operation]);
        $feedItemAdGroupTarget = $result->getValue()[0];
        printf(
            'Feed item target for feed ID %d and feed item ID %d was '
            . 'created to restrict serving to ad group ID %d.%s',
            $feedItemAdGroupTarget->getFeedId(),
            $feedItemAdGroupTarget->getFeedItemId(),
            $feedItemAdGroupTarget->getAdGroupId(),
            PHP_EOL
        );
    }
private static function restrictFeedItemToAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedId , $ feedItemId , $ adGroupId ) { $ feedItemTargetService = $ adWordsServices -> get ( $ session , FeedItemTargetService :: class ) ; // Create a feed item ad group target. $ feedItemAdGroupTarget = new FeedItemAdGroupTarget ( ) ; $ feedItemAdGroupTarget -> setFeedId ( $ feedId ) ; $ feedItemAdGroupTarget -> setFeedItemId ( $ feedItemId ) ; $ feedItemAdGroupTarget -> setAdGroupId ( $ adGroupId ) ; // Create a feed item ad group target operation. $ operation = new FeedItemTargetOperation ( ) ; $ operation -> setOperand ( $ feedItemAdGroupTarget ) ; $ operation -> setOperator ( Operator :: ADD ) ; // Create the feed item ad group target on the server and print out // some information. $ result = $ feedItemTargetService -> mutate ( [ $ operation ] ) ; $ feedItemAdGroupTarget = $ result -> getValue ( ) [ 0 ] ; printf ( 'Feed item target for feed ID %d and feed item ID %d was ' . 'created to restrict serving to ad group ID %d.%s' , $ feedItemAdGroupTarget -> getFeedId ( ) , $ feedItemAdGroupTarget -> getFeedItemId ( ) , $ feedItemAdGroupTarget -> getAdGroupId ( ) , PHP_EOL ) ; }
Creates feed item ad group target for a specified feed ID, feed item ID,
and ad group ID.
Creates feed item ad group target for a specified feed ID feed item ID and ad group ID .