AdWordCriterionServiceAdWords Lib Criterion Class
Use this class to work with Google AdWords Criterion Service CriterionService provides operations for accessing, modifying, and creating Criteria (Keywords and Websites) in an AdGroup.
Located in /services/AdWordCriterionService.inc
AdWordService | --AdWordCriterionService
object|false
checkCriteria
(array $criteria, [object AdWordLanguageTarget $languageTarget = ''], [object AdWordGeoTarget $geoTarget = ''], [string $clientEmail = ''])
array|false
getCriterionStats
(int $adGroupId, array $criterionIds, string $start, string $end, [string $clientEmail = ''])
AdWordCriterionService Constructor. It takes one parameter - name of a supported by AdWords Lib SOAP toolkit
Example:
- <?php
- ?>
Adds a new Criteria to an AdGroup.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$newCriteria is an array of objects of class AdWordCriterion
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is an array of objects of class AdWordCriterion which hold the new created criteria
- ?>
Check a batch of criteria for policy errors.
The number of criteria in the batch is limited to the maximum number of criteria per adgroup.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$criteria is an array of objects of class AdWordCriterion
- //$languageTarget is an object of class AdWordLanguageTarget
- //$geoTarget is an object of class AdWordGeoTarget
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is an array of objects of class ApiError which hold a list of policy errors
- ?>
Return a list of criteria associated with this AdGroup.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$adGroupId - ID of the adGroup
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is an array of objects of class AdWordCriterion
- ?>
Gets a list of the negative criteria associated with a campaign.
Negative criteria determine where the ads in the campaign will not be displayed. Negative website criteria indicate websites where the ads will not appear. Negative keyword criteria indicate keywords that cause the ads to be excluded from display.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$campaignId - ID of the campaign
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is an array of objects of class AdWordCriterion
- ?>
Return a list of criteria with the specified IDs associated with this AdGroup.
This function will only return criteria associated with one AdGroup at a time. Invalid IDs are ignored.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$adGroupId - ID of the adGroup
- //$criterionId1, $criterionId2 - Criterion IDs
- $criterionIds = array($criterionId1, $criterionId2);
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is an array of objects of class AdWordCriterion
- ?>
Get statistics for a list of criteria in an ad group.
See StatsRecord for details about the statistics returned. The time granularity is one day. We use data types that include timezone information so that the dates can be properly normalized. (Note that statistics are not included for negative criteria.)
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$adGroupId - ID of the adGroup
- //$criterionId1, $criterionId2 - Criterion IDs
- $criterionIds = array($criterionId1, $criterionId2);
- $start = '2005-01-01T00:00:00Z';
- $end = '2005-02-01T00:00:00Z';
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is an array of objects of class AdWordStatsRecord
- ?>
Remove a list of Criteria from an AdGroup.
Note that there is no 'undo' for this operation.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$adGroupId - ID of the adGroup
- //$criterionId1, $criterionId2 - Criterion IDs
- $criterionIds = array($criterionId1, $criterionId2);
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response == true
- ?>
Removes all existing negative criteria from a campain and sets new negative criteria for the specified campaign.
Negative criteria determine where the ads in the campaign will not be displayed. Negative website criteria indicate websites where the ads will not appear. Negative keyword criteria indicate keywords that cause the ads to be excluded from display.
Calling this method with a null or empty list clears the negative criteria for the campaign. If your campaign already has some negative criteria and you want to add more, first call getCampaignNegativeCriteria, then add the new negative criteria to the results and send the complete set of negative criteria to setCampaignNegativeCriteria.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$criteria is an array of objects of class AdWordCriterion
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response is true on success, false on failure
- ?>
Update all mutable fields associated with these Criteria.
Only the maxCpc, maxCpm, negative, and destinationUrl fields are mutable.
Example:
- <?php
- $criterionService->setAccount($myEmail, $myPass, $myUserAgent, $myDeveloperToken, $myApplicationToken);
- //$criterion1, $criterion2 is an object of class AdWordCriterion
- $criteria = array($criterion1, $criterion2);
- $response = $criterionService->updateKeywordList($criteria);
- if ($response === false) { // if an error appears
- echo $errr->toString(); //output error
- exit();
- }
- //$response == true
- ?>
Inherited From AdWordService
AdWordService::AdWordService()
AdWordService::callService()
AdWordService::getAccount()
AdWordService::getClientCustomerId()
AdWordService::getClientEmail()
AdWordService::getLastError()
AdWordService::getResponseHeaders()
AdWordService::setAccount()
AdWordService::setClientCustomerId()
AdWordService::setClientEmail()
Documentation generated on Mon, 10 Sep 2007 15:07:17 +0300 by phpDocumentor 1.3.2