examples/AdWords/v201809/AdvancedOperations/AddShoppingDynamicRemarketingCampaign.php
private static function attachUserList(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdGroup $adGroup,
        $userListId
    ) {
        $adGroupCriterionService =
            $adWordsServices->get($session, AdGroupCriterionService::class);

        // Creates criterion user list.
        $userList = new CriterionUserList();
        $userList->setUserListId($userListId);

        // Creates ad group criterion.
        $adGroupCriterion = new BiddableAdGroupCriterion();
        $adGroupCriterion->setCriterion($userList);
        $adGroupCriterion->setAdGroupId($adGroup->getId());

        // Creates operation.
        $adGroupCriterionOperation = new AdGroupCriterionOperation();
        $adGroupCriterionOperation->setOperand($adGroupCriterion);
        $adGroupCriterionOperation->setOperator(Operator::ADD);

        // Makes the mutate request.
        $adGroupCriterionAddResult =
            $adGroupCriterionService->mutate([$adGroupCriterionOperation]);
        $adGroupCriterion = $adGroupCriterionAddResult->getValue()[0];

        return $adGroupCriterion;
    }
private static function attachUserList(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdGroup $adGroup,
        $userListId
    ) {
        $adGroupCriterionService =
            $adWordsServices->get($session, AdGroupCriterionService::class);

        // Creates criterion user list.
        $userList = new CriterionUserList();
        $userList->setUserListId($userListId);

        // Creates ad group criterion.
        $adGroupCriterion = new BiddableAdGroupCriterion();
        $adGroupCriterion->setCriterion($userList);
        $adGroupCriterion->setAdGroupId($adGroup->getId());

        // Creates operation.
        $adGroupCriterionOperation = new AdGroupCriterionOperation();
        $adGroupCriterionOperation->setOperand($adGroupCriterion);
        $adGroupCriterionOperation->setOperator(Operator::ADD);

        // Makes the mutate request.
        $adGroupCriterionAddResult =
            $adGroupCriterionService->mutate([$adGroupCriterionOperation]);
        $adGroupCriterion = $adGroupCriterionAddResult->getValue()[0];

        return $adGroupCriterion;
    }
private static function attachUserList ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup , $ userListId ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; // Creates criterion user list. $ userList = new CriterionUserList ( ) ; $ userList -> setUserListId ( $ userListId ) ; // Creates ad group criterion. $ adGroupCriterion = new BiddableAdGroupCriterion ( ) ; $ adGroupCriterion -> setCriterion ( $ userList ) ; $ adGroupCriterion -> setAdGroupId ( $ adGroup -> getId ( ) ) ; // Creates operation. $ adGroupCriterionOperation = new AdGroupCriterionOperation ( ) ; $ adGroupCriterionOperation -> setOperand ( $ adGroupCriterion ) ; $ adGroupCriterionOperation -> setOperator ( Operator :: ADD ) ; // Makes the mutate request. $ adGroupCriterionAddResult = $ adGroupCriterionService -> mutate ( [ $ adGroupCriterionOperation ] ) ; $ adGroupCriterion = $ adGroupCriterionAddResult -> getValue ( ) [ 0 ] ; return $ adGroupCriterion ; }
Attaches a user list to an ad group. The user list provides positive
targeting and feed information to drive the dynamic content of the ad.

<p>Note: User lists are only supported at the ad group level for
positive targeting in dynamic remarketing campaigns.

@param AdWordsServices $adWordsServices the AdWords services
@param AdWordsSession $session the AdWords session
@param AdGroup $adGroup the ad group to attach the user list used for
dynamic feed content
@param int $userListId the user list ID to use for targeting and dynamic
content.
@return BiddableAdGroupCriterion the attached ad group criterion
Attaches a user list to an ad group . The user list provides positive targeting and feed information to drive the dynamic content of the ad .