$targetingSetting->details[] = new TargetingSettingDetail('VERTICAL', true); $adGroup->settings[] = $targetingSetting; // Create operation. $operation = new AdGroupOperation(); $operation->operand = $adGroup; $operation->operator = 'ADD'; $operations[] = $operation; } // Make the mutate request. $result = $adGroupService->mutate($operations); // Display result. $adGroups = $result->value; foreach ($adGroups as $adGroup) { printf("Ad group with name '%s' and ID '%s' was added.\n", $adGroup->name, $adGroup->id); } } // Don't run the example if the file is being included. if (__FILE__ != realpath($_SERVER['PHP_SELF'])) { return; } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. $user->LogAll(); // Run the example. AddAdGroupsExample($user, $campaignId); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }
public function testAddAdGroupsExample() { AddAdGroupsExample($this->user, $this->campaignId); }