examples/AdWords/v201809/AdvancedOperations/AddShoppingDynamicRemarketingCampaign.php
private static function createAdGroup(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        Campaign $campaign
    ) {
        $adGroupService =
            $adWordsServices->get($session, AdGroupService::class);

        // Creates ad group.
        $adGroup = new AdGroup();
        $adGroup->setCampaignId($campaign->getId());
        $adGroup->setName('Dynamic remarketing ad group #' . uniqid());
        $adGroup->setStatus(AdGroupStatus::ENABLED);

        // Creates operation.
        $adGroupOperation = new AdGroupOperation();
        $adGroupOperation->setOperand($adGroup);
        $adGroupOperation->setOperator(Operator::ADD);

        // Makes the mutate request.
        $adGroupAddResult = $adGroupService->mutate([$adGroupOperation]);
        $adGroup = $adGroupAddResult->getValue()[0];

        return $adGroup;
    }
private static function createAdGroup(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        Campaign $campaign
    ) {
        $adGroupService =
            $adWordsServices->get($session, AdGroupService::class);

        // Creates ad group.
        $adGroup = new AdGroup();
        $adGroup->setCampaignId($campaign->getId());
        $adGroup->setName('Dynamic remarketing ad group #' . uniqid());
        $adGroup->setStatus(AdGroupStatus::ENABLED);

        // Creates operation.
        $adGroupOperation = new AdGroupOperation();
        $adGroupOperation->setOperand($adGroup);
        $adGroupOperation->setOperator(Operator::ADD);

        // Makes the mutate request.
        $adGroupAddResult = $adGroupService->mutate([$adGroupOperation]);
        $adGroup = $adGroupAddResult->getValue()[0];

        return $adGroup;
    }
private static function createAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , Campaign $ campaign ) { $ adGroupService = $ adWordsServices -> get ( $ session , AdGroupService :: class ) ; // Creates ad group. $ adGroup = new AdGroup ( ) ; $ adGroup -> setCampaignId ( $ campaign -> getId ( ) ) ; $ adGroup -> setName ( 'Dynamic remarketing ad group #' . uniqid ( ) ) ; $ adGroup -> setStatus ( AdGroupStatus :: ENABLED ) ; // Creates operation. $ adGroupOperation = new AdGroupOperation ( ) ; $ adGroupOperation -> setOperand ( $ adGroup ) ; $ adGroupOperation -> setOperator ( Operator :: ADD ) ; // Makes the mutate request. $ adGroupAddResult = $ adGroupService -> mutate ( [ $ adGroupOperation ] ) ; $ adGroup = $ adGroupAddResult -> getValue ( ) [ 0 ] ; return $ adGroup ; }
Creates an ad group in the specified campaign.

@param AdWordsServices $adWordsServices the AdWords services
@param AdWordsSession $session the AdWords session
@param Campaign $campaign the campaign to which the ad group should be
attached
@return AdGroup the created ad group
Creates an ad group in the specified campaign .