$adGroup = new AdGroup(); $adGroup->id = $adGroupId; $adGroup->status = 'DELETED'; // Rename the ad group as you delete it, to avoid future name conflicts. $adGroup->name = 'Deleted ' . date('Ymd his'); // Create operations. $operation = new AdGroupOperation(); $operation->operand = $adGroup; $operation->operator = 'SET'; $operations = array($operation); // Make the mutate request. $result = $adGroupService->mutate($operations); // Display result. $adGroup = $result->value[0]; printf("Ad group with id '%s' was deleted.\n", $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. DeleteAdGroupExample($user, $adGroupId); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }
public function testDeleteAdGroupExample() { $adGroupId = $this->testUtils->CreateAdGroup($this->campaignId); DeleteAdGroupExample($this->user, $adGroupId); }