Google APIlity Library Reference
The APIlity PHP Library provides an object-oriented way to easily access and manage the Google AdWords API from within PHP.This comes along with an abstraction from the SOAP and WSDL details.
This reference documents all functions offered by the library. The functions are categorized into several sections with different senses.
Please note: each section has its own color represented by a colored bar at the right side and the particular link color. Thus orientation is very easy.
Quicknavigator
|
APIlity structure
Click the images to resize the class organigram and/or the object hierarchy: |
Campaign.php
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
Object Operations
getAdScheduling()
Returns the Campaign's ad schedule.
Parameters:
NoneResponse:
adScheduling = array(
'status',
'intervals' = array(
array(
'day',
'startHour',
'startMinute',
'endHour',
'endMinute',
'multiplier'
)
)
)Sample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getAdScheduling());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getAllAdGroups()
Returns all AdGroups of a given Campaign.
Parameters:
NoneResponse:
[AdGroup] allAdGroupObjectsSample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getAllAdGroups());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getBelongsToClientEmail()
Returns the client email this Campaign belongs to.
Parameters:
NoneResponse:
String emailSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getBelongsToClientEmail();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getBudgetAmount()
Returns the Campaign's budget amount.
Parameters:
NoneResponse:
Integer budgetAmountSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getBudgetAmount();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getBudgetOptimizerSettings()
Returns the Campaign's budget optimizer settings.
Parameters:
NoneResponse:
budgetOptimizerSettings = array(
'bidCeiling',
'enabled',
'takeOnOptimizedBids'
)Sample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getBudgetOptimizerSettings());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getBudgetPeriod()
Returns the Campaign's budget period.
Parameters:
NoneResponse:
String budgetPeriodSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getBudgetPeriod();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getCampaignData()
Returns all the Campaign's attributes in one go.
Parameters:
NoneResponse:
campaignData = array(
'name',
'id',
'belongsToClientEmail',
'status',
'startDate',
'endDate',
'budgetAmount',
'budgetPeriod',
'networkTargeting',
'languages',
'geoTargets',
'isEnabledSeparateContentBids',
'isEnabledOptimizedAdServing'
)Sample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getCampaignData());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getCampaignNegativeKeywordCriteria()
Returns the Campaign's Negative Keyword Criteria.
Parameters:
NoneResponse:
campaignNegativeKeywords = array(
array(
'text',
'type'
)
)Sample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getCampaignNegativeKeywordCriteria());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getCampaignNegativeWebsiteCriteria()
Returns the Campaign's Negative Website Criteria.
Parameters:
NoneResponse:
campaignNegativeWebsites = array(
array(
'url',
)
)Sample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getCampaignNegativeWebsiteCriteria());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getCampaignStats($startDate, $endDate)
Returns the statistical data for a Campaign during the given period of time.
Parameters:
String startDate
String endDateResponse:
campaignStats = array(
'averagePosition',
'clicks',
'conversionRate',
'conversions',
'cost',
'id',
'impressions',
'name'
)Sample:
$yesterday = gmdate(
"Y-m-d",
mktime(
date("H"),
date("i"),
date("s"),
date("m"),
date("d") - 1,
date("Y")
)
);
$dayBeforeYesterday = gmdate(
"Y-m-d",
mktime(
date("H"),
date("i"),
date("s"),
date("m"),
date("d") - 2,
date("Y")
)
);
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getCampaignStats($dayBeforeYesterday, $yesterday));
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getEndDate()
Returns the Campaign's end date.
Parameters:
NoneResponse:
String endDateSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getEndDate();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getEstimate()
Returns a performance estimate for the Campaign.
Parameters:
NoneResponse:
campaignEstimate = array(
array(
array(
'text',
'lowerAveragePosition',
'upperAveragePosition',
'lowerCostPerClick',
'upperCostPerClick',
'lowerClicksPerDay',
'upperClicksPerDay'
),
'adGroupName',
'adGroupId'
),
'campaignName',
'campaignId'
)Sample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getEstimate());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getGeoTargets()
Returns the Campaign's geo targetings.
Parameters:
NoneResponse:
[String] geoTargetsSample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getGeoTargets());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getId()
Returns the Campaign's ID.
Parameters:
NoneResponse:
Integer id // for MySQL use BigIntSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getId();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getIsEnabledOptimizedAdServing()
Returns if the advertisment serving of the Campaign is being optimized.
Parameters:
NoneResponse:
Boolean isEnabledOptimizedAdServingSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getIsEnabledOptimizedAdServing();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getIsEnabledSeparateContentBids()
Returns if the separate content bids feature is enabled.
Parameters:
NoneResponse:
Boolean isEnabledSeparateContentBidsSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getIsEnabledSeparateContentBids();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getLanguages()
Returns the Campaign's language targeting.
Parameters:
NoneResponse:
[String] languagesSample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getLanguages());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getName()
Returns the Campaign's name.
Parameters:
NoneResponse:
String nameSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getName();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getNetworkTargeting()
Returns the Campaign's network targeting.
Parameters:
NoneResponse:
[String] networkTargetingSample:
$campaignObject = createCampaignObject(123456789);
print_r($campaignObject->getNetworkTargeting());
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getStartDate()
Returns the Campaign's start date.
Parameters:
NoneResponse:
String startDateSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getStartDate();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
getStatus()
Returns the Campaign's status.
Parameters:
NoneResponse:
String statusSample:
$campaignObject = createCampaignObject(123456789);
echo $campaignObject->getStatus();
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setAdScheduling($newAdScheduling)
Sets the Campaign's new ad schedule.
Parameters:
newAdScheduling = array(
'status',
'intervals' = array(
array(
'day',
'startHour',
'startMinute',
'endHour',
'endMinute',
'multiplier',
)
)
)None
Sample:
$interval1 = array();
$interval1['multiplier'] = 1.5;
$interval1['day'] = "Saturday";
$interval1['startHour'] = 13;
$interval1['startMinute'] = 0;
$interval1['endHour'] = 15;
$interval1['endMinute'] = 15;
$interval2 = array();
$interval2['multiplier'] = 0.7;
$interval2['day'] = "Sunday";
$interval2['startHour'] = 9;
$interval2['startMinute'] = 30;
$interval2['endHour'] = 10;
$interval2['endMinute'] = 45;
$adScheduling = array(
'status' => "Enabled",
'intervals' => array(
$interval1,
$interval2
)
);
$campaignObject = createCampaignObject(123456789);
$campaignObject->setAdScheduling($adScheduling);
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setBudgetAmount($newBudgetAmount)
Sets a new Campaign budget amount.
Parameters:
Integer newBudgetAmountResponse:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$campaignObject->setBudgetAmount(1000);
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setBudgetOptimizerSettings($newBudgetOptimizerSettings)
Sets the Campaign's budget optimizer settings.
Parameters:
newBudgetOptimizerSettings = array(
'bidCeiling',
'enabled',
'takeOnOptimizedBids'
)Response:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$budgetOptimizerSettings = array(
'bidCeiling' => 42,
'enabled' => true,
'takeOnOptimizedBids' => true
);
$campaignObject->setBudgetOptimizerSettings($budgetOptimizerSettings);
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setBudgetPeriod($newBudgetPeriod)
Sets a new Campaign budget period.
Parameters:
String newBudgetPeriodResponse:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$campaignObject->setBudgetPeriod('Daily');
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setCampaignNegativeKeywordCriteria($newCampaignNegativeKeywords)
Sets new Campaign Negative Keyword Criteria. Already existing Campaign Negative Keyword Criteria will be overwritten. However, already existing Campaign Negative Website Criteria will be kept.
Parameters:
newCampaignNegativeKeywords = array(
array(
'text',
'type'
)
)Response:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$negativeCriterion1 = array('text' => "none", 'type' => "Broad");
$negativeCriterion2 = array('text' => "of these", 'type' => "Phrase");
$campaignObject->setCampaignNegativeKeywordCriteria(
array($negativeCriterion1, $negativeCriterion2)
);
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setCampaignNegativeWebsiteCriteria($newCampaignNegativeWebsites)
Sets new Campaign Negative Website Criteria. Already existing Campaign Negative Website Criteria will be overwritten. However, already existing Campaign Negative Keyword Criteria will be kept.
Parameters:
newCampaignNegativeWebsites = array(
array(
'url'
)
)Response:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$negativeCriterion1 = array('url' => "spiegel.de");
$negativeCriterion2 = array('url' => "aol.com");
$campaignObject->setCampaignNegativeWebsiteCriteria(
array($negativeCriterion1, $negativeCriterion2)
);
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setConversionOptimizerSettings($conversionOptimizerSettings)
Sets the Campaign's conversion optimizer settings.
Parameters:
newConversionOptimizerSettings = array(
'enabled',
'maxCpaBidForAllAdGroups'
)Response:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$conversionOptimizerSettings = array(
'enabled' => true,
'maxCpaBidForAllAdGroups' => 10
);
$campaignObject->setConversionOptimizerSettings($conversionOptimizerSettings);
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setEndDate($newEndDate)
Sets a new Campaign end date.
Parameters:
String newEndDateResponse:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$campaignObject->setEndDate("2011-12-17");
Quicknavigatior
• Back To Top
• APIlity Home
• APIlity Forum
» Campaign |
» AdGroup |
» Criterion |
» Ad |
» Report |
» KeywordTool |
» SiteSuggestion |
» TrafficEstimate |
» Account |
» Info
setGeoTargets($newGeoTargets)
Sets new Campaign geo targets.
Parameters:
newGeoTargets = array(
'countryTargets' => array(
'countries' => array()
),
'regionTargets' => array(
'regions' => array()
),
'metroTargets' => array(
'metros' => array()
),
'cityTargets' => array(
'cities' => array()
),
'proximityTargets' => array(
'circles' => array(
'latitudeMicroDegrees',
'longitudeMicroDegrees',
'radiusMeters'
)
),
'targetAll'
)Response:
NoneSample:
$campaignObject = createCampaignObject(123456789);
$newGeoTargets = array(
'countryTargets' => array(
'countries' => array()
),
'regionTargets' => array(
'regions' => array()
),
'metroTargets' => array(
'metros' => array()
),
'cityTargets' => array(
'cities' => array(
"Reutlingen, BW DE",
&n
