examples/AdWords/v201809/AdvancedOperations/AddAdCustomizer.php
private static function createCustomizerFeedItems(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdCustomizerFeed $adCustomizerFeed,
        array $adGroupIds
    ) {
        $feedItemService = $adWordsServices->get($session, FeedItemService::class);

        $operations = [];

        $marsDate = mktime(0, 0, 0, date('m'), 1, date('Y'));
        $venusDate = mktime(0, 0, 0, date('m'), 15, date('Y'));

        // Create multiple feed item operations and add them to the operations list.
        $operations[] = self::createFeedItemAddOperation(
            'Mars',
            '$1234.56',
            date('Ymd His', $marsDate),
            $adCustomizerFeed
        );
        $operations[] = self::createFeedItemAddOperation(
            'Venus',
            '$1450.00',
            date('Ymd His', $venusDate),
            $adCustomizerFeed
        );

        $result = $feedItemService->mutate($operations);

        foreach ($result->getValue() as $feedItem) {
            printf(
                'FeedItem with ID %d was added.%s',
                $feedItem->getFeedItemId(),
                PHP_EOL
            );
        }
        for ($i = 0; $i < count($result->getValue()); $i++) {
            // Add feed item targeting to restrict the feed item to specific ad
            // groups.
            self::restrictFeedItemToAdGroup(
                $adWordsServices,
                $session,
                $result->getValue()[$i],
                $adGroupIds[$i]
            );
        }
    }
private static function createCustomizerFeedItems(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdCustomizerFeed $adCustomizerFeed,
        array $adGroupIds
    ) {
        $feedItemService = $adWordsServices->get($session, FeedItemService::class);

        $operations = [];

        $marsDate = mktime(0, 0, 0, date('m'), 1, date('Y'));
        $venusDate = mktime(0, 0, 0, date('m'), 15, date('Y'));

        // Create multiple feed item operations and add them to the operations list.
        $operations[] = self::createFeedItemAddOperation(
            'Mars',
            '$1234.56',
            date('Ymd His', $marsDate),
            $adCustomizerFeed
        );
        $operations[] = self::createFeedItemAddOperation(
            'Venus',
            '$1450.00',
            date('Ymd His', $venusDate),
            $adCustomizerFeed
        );

        $result = $feedItemService->mutate($operations);

        foreach ($result->getValue() as $feedItem) {
            printf(
                'FeedItem with ID %d was added.%s',
                $feedItem->getFeedItemId(),
                PHP_EOL
            );
        }
        for ($i = 0; $i < count($result->getValue()); $i++) {
            // Add feed item targeting to restrict the feed item to specific ad
            // groups.
            self::restrictFeedItemToAdGroup(
                $adWordsServices,
                $session,
                $result->getValue()[$i],
                $adGroupIds[$i]
            );
        }
    }
private static function createCustomizerFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdCustomizerFeed $ adCustomizerFeed , array $ adGroupIds ) { $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ operations = [ ] ; $ marsDate = mktime ( 0 , 0 , 0 , date ( 'm' ) , 1 , date ( 'Y' ) ) ; $ venusDate = mktime ( 0 , 0 , 0 , date ( 'm' ) , 15 , date ( 'Y' ) ) ; // Create multiple feed item operations and add them to the operations list. $ operations [ ] = self :: createFeedItemAddOperation ( 'Mars' , '$1234.56' , date ( 'Ymd His' , $ marsDate ) , $ adCustomizerFeed ) ; $ operations [ ] = self :: createFeedItemAddOperation ( 'Venus' , '$1450.00' , date ( 'Ymd His' , $ venusDate ) , $ adCustomizerFeed ) ; $ result = $ feedItemService -> mutate ( $ operations ) ; foreach ( $ result -> getValue ( ) as $ feedItem ) { printf ( 'FeedItem with ID %d was added.%s' , $ feedItem -> getFeedItemId ( ) , PHP_EOL ) ; } for ( $ i = 0 ; $ i < count ( $ result -> getValue ( ) ) ; $ i ++ ) { // Add feed item targeting to restrict the feed item to specific ad // groups. self :: restrictFeedItemToAdGroup ( $ adWordsServices , $ session , $ result -> getValue ( ) [ $ i ] , $ adGroupIds [ $ i ] ) ; } }
Creates feed items with the values to use in ad customizations for each ad
group.

@param AdWordsServices $adWordsServices the AdWords services
@param AdWordsSession $session the AdWords session
@param AdCustomizerFeed $adCustomizerFeed the ad customizer feed
@param int[] $adGroupIds the ad group IDs to add the ad customizer
Creates feed items with the values to use in ad customizations for each ad group .