} // Add a negative campaign criterion. $negativeKeyword = new Keyword(); $negativeKeyword->text = 'jupiter cruise'; $negativeKeyword->matchType = 'BROAD'; $negativeCriterion = new NegativeCampaignCriterion(); $negativeCriterion->campaignId = $campaignId; $negativeCriterion->criterion = $negativeKeyword; $operations[] = new CampaignCriterionOperation($negativeCriterion, 'ADD'); // Make the mutate request. $result = $campaignCriterionService->mutate($operations); // Display results. foreach ($result->value as $campaignCriterion) { printf("Campaign targeting criterion with ID '%s' and type '%s' was " . "added.\n", $campaignCriterion->criterion->id, $campaignCriterion->criterion->CriterionType); } } // 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. AddCampaignTargetingCriteriaExample($user, $campaignId, $locationFeedId); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }
$campaignCriteria[] = new CampaignCriterion($campaignId, null, $english); $spanish = new Language(); $spanish->id = 1003; $campaignCriteria[] = new CampaignCriterion($campaignId, null, $spanish); // Create operations. $operations = array(); foreach ($campaignCriteria as $campaignCriterion) { $operations[] = new CampaignCriterionOperation($campaignCriterion, 'ADD'); } // Make the mutate request. $result = $campaignCriterionService->mutate($operations); // Display results. foreach ($result->value as $campaignCriterion) { printf("Campaign targeting criterion with ID '%s' and type '%s' was " . "added.\n", $campaignCriterion->criterion->id, $campaignCriterion->criterion->CriterionType); } } // 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. AddCampaignTargetingCriteriaExample($user, $campaignId); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }
public function testAddCampaignTargetingCriteriaExample() { AddCampaignTargetingCriteriaExample($this->user, $this->campaignId); }