Google APIlity Library Documentation

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:

APIlity class organigram   |   APIlity object hierarchy

Campaign.php

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

Object Operations

getActiveAdGroups
getAdScheduling
getAllAdGroups
getBelongsToClientEmail
getBudgetAmount
getBudgetOptimizerSettings
getBudgetPeriod
getCampaignData
getCampaignNegativeKeywordCriteria
getCampaignNegativeWebsiteCriteria
getCampaignStats
getEndDate
getEstimate
getGeoTargets
getId
getIsEnabledOptimizedAdServing
getLanguages
getName
getNetworkTargeting
getRecommendedBudget
getStartDate
getStatus
setAdScheduling
setBudgetAmount
setBudgetOptimizerSettings
setBudgetPeriod
setCampaignNegativeKeywordCriteria
setCampaignNegativeWebsiteCriteria
setConversionOptimizerSettings
setEndDate
setGeoTargets
setIsEnabledOptimizedAdServing
setLanguages
setName
setNetworkTargeting
setStatus
toXml

Class Operations

addCampaign
addCampaignList
addCampaignsOneByOne
createCampaignObject
getActiveCampaigns
getAllCampaigns
getCampaignList
removeCampaign
APIlity uses these native API Campaign functions.
These function are defined in the Campaign Service WSDL.

Object Operations

Class Operations

addCampaign(
  $name,
  $status,
  $startDate,
  $endDate,
  $budgetAmount,
  $budgetPeriod,
  $networkTargeting,
  $languages,
  $geoTargets,
  $adScheduling,
  $budgetOptimizerSettings
)
Adds a Campaign to the current customer's account.
Parameters:
String name
String status
String startDate  // Pass "" in order to start the Campaign directly after creation
String endDate  // Pass "" in order to get a Campaign that never ends
Integer budgetAmount
String budgetPeriod
[String] networkTargeting
[String] languages  // Pass array("all") to select all languages
newGeoTargets = array(
  'countryTargets' => array(
    'countries' => array(),
    'excludedCountries' => array(),
  ),
  'regionTargets' => array(
    'regions' => array(),
    'excludedRegions' => array()
  ),
  'metroTargets' => array(
    'metros' => array(),
    'excludedMetros' => array()
  ),
  'cityTargets' => array(
    'cities' => array(),
    'excludedCities' => array(),
  ),
  'proximityTargets' => array(
    'circles' => array(
      'latitudeMicroDegrees',
      'longitudeMicroDegrees',
      'radiusMeters'
    )
  ),
  'targetAll'
)
{AdScheduling adScheduling}
{BudgetOptimizerSettings budgetOptimizerSettings}

Response:
Campaign campaignObject

Sample:
$campaignObject addCampaign(
  
"Test",
  
"Active",
  
"2007-01-01",
  
"2011-01-01",
  
50,
  
'Daily',
  array(
"GoogleSearch""ContentNetwork"),
  array(
"fr""de"),
  array(
    
'countryTargets' => array(
      
'countries' => array()
    ),
    
'regionTargets' => array(
      
'regions' => array()
    ),
    
'metroTargets' => array(
      
'metros' => array()
    ),
    
'cityTargets' => array(
      
'cities' => array("Grenoble, V FR")
    ),
    
'proximityTargets' => array(
      
'circles' => array()
    )
  )
); 

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

addCampaignList($campaigns)
Adds a list of Campaigns to the current customer's account. Please note: this will fail completely even if just one Campaign fails, but the function causes no SOAP overhead.
Parameters:
campaigns = array(
  array(
    'name',
    'status',
    'startDate',  // Pass "" in order to start the Campaign directly after creation
    'endDate',  // Pass "" in order to get a Campaign that never ends
    'budgetAmount',
    'budgetPeriod',
    'networkTargeting',
    'languages',  // Pass array("all") to select all languages
    'geoTargets' = array(
      'countryTargets' => array(
        'countries' => array(),
        'excludedCountries' => array()
      ),
      'regionTargets' => array(
        'regions' => array(),
        'excludedRegions' => array()
      ),
      'metroTargets' => array(
        'metros' => array(),
        'excludedMetros' => array()
      ),
      'cityTargets' => array(
        'cities' => array(),
        'excludedCities' => array()
      ),
      'proximityTargets' => array(
        'circles' => array(
          'latitudeMicroDegrees',
          'longitudeMicroDegrees',
          'radiusMeters'
        )
      ),
      'targetAll'
    )
    {'adScheduling'}
    {'budgetOptimizerSettings'}
  )
)

Response:
[Campaign] campaignObjects

Sample:
$campaign1 = array(
  
'name' => "Test1",
  
'status' => "Active",
  
'startDate' => "2007-01-01",
  
'endDate' => "2011-01-01",
  
'budgetAmount' => 50,
  
'budgetPeriod' => 'Daily',
  
'networkTargeting' => array("GoogleSearch""ContentNetwork"),
  
'languages' => array("de""en"),
  
'geoTargets' => array(
    
'countryTargets' => array(
      
'countries' => array()
    ),
    
'regionTargets' => array(
      
'regions' => array()
    ),
    
'metroTargets' => array(
      
'metros' => array()
    ),
    
'cityTargets' => array(
      
'cities' => array(
        
"Grenoble, V FR"
      
)
    ),
    
'proximityTargets' => array(
      
'circles' => array()
    )
  )
);
$campaign2 = array(
  
'name' => "Test2",
  
'status' => "Active",
  
'startDate' => "2007-01-01",
  
'endDate' => "2011-01-01",
  
'budgetAmount' => 50,
  
'budgetPeriod' => 'Daily',
  
'networkTargeting' => array("GoogleSearch""ContentNetwork"),
  
'languages' => array("de"),
  
'geoTargets' => array(
    
'countryTargets' => array(
      
'countries' => array()
    ),
    
'regionTargets' => array(
      
'regions' => array()
    ),
    
'metroTargets' => array(
      
'metros' => array()
    ),
    
'cityTargets' => array(
      
'cities' => array(
        
"Grenoble, V FR"
      
)
    ),
    
'proximityTargets' => array(
      
'circles' => array()
    )
  )
);
$campaignObjects addCampaignList(array($campaign1$campaign2)); 

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

addCampaignsOneByOne($campaigns)
Adds a list of Campaigns to the current customer's account. Please note: this will not fail completely if just one Campaign fails, but the function causes a lot of SOAP overhead.
Parameters:
campaigns = array(
  array(
    'name',
    'status',
    'startDate',  // Pass "" in order to start the Campaign directly after creation
    'endDate',  // Pass "" in order to get a Campaign that never ends
    'budgetAmount',
    'budgetPeriod',
    'networkTargeting',
    'languages',  // Pass array("all") to select all languages
    'geoTargets' = array(
      'countryTargets' => array(
        'countries' => array(),
        'excludedCountries' => array()
      ),
      'regionTargets' => array(
        'regions' => array(),
        'excludedRegions' => array()
      ),
      'metroTargets' => array(
        'metros' => array(),
        'excludedMetros' => array()
      ),
      'cityTargets' => array(
        'cities' => array(),
        'excludedCities' => array()
      ),
      'proximityTargets' => array(
        'circles' => array(
          'latitudeMicroDegrees',
          'longitudeMicroDegrees',
          'radiusMeters'
        )
      ),
      'targetAll',
    )
    {'adScheduling'}
    {'budgetOptimizerSettings'}
  )
)

Response:
[Campaign] campaignObjects

Sample:
$campaign1 = array(
  
'name' => "Test1",
  
'status' => "Active",
  
'startDate' => "2007-01-01",
  
'endDate' => "2011-01-01",
  
'budgetAmount' => 50,
  
'budgetPeriod' => 'Daily',
  
'networkTargeting' => array("GoogleSearch""ContentNetwork"),
  
'languages' => array("de""en"),
  
'geoTargets' => array(
    
'countryTargets' => array(
      
'countries' => array()
    ),
    
'regionTargets' => array(
      
'regions' => array()
    ),
    
'metroTargets' => array(
      
'metros' => array()
    ),
    
'cityTargets' => array(
      
'cities' => array(
        
"Grenoble, V FR"
      
)
    ),
    
'proximityTargets' => array(
      
'circles' => array()
    )
  )
);
$campaign2 = array(
  
'name' => "Test2",
  
'status' => "Active",
  
'startDate' => "2007-01-01",
  
'endDate' => "2011-01-01",
  
'budgetAmount' => 50,
  
'budgetPeriod' => 'Daily',
  
'networkTargeting' => array("GoogleSearch""ContentNetwork"),
  
'languages' => array("de"),
  
'geoTargets' => array(
    
'countryTargets' => array(
      
'countries' => array()
    ),
    
'regionTargets' => array(
      
'regions' => array()
    ),
    
'metroTargets' => array(
      
'metros' => array()
    ),
    
'cityTargets' => array(
      
'cities' => array(
        
"Grenoble, V FR"
      
)
    ),
    
'proximityTargets' => array(
      
'circles' => array()
    )
  )
);
$campaignObjects addCampaignsOneByOne(array($campaign1$campaign2)); 

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

AdGroup.php

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

Object Operations

getActiveAds
getAdGroupData
getAdGroupStats
getAllAds
getAllCriteria
getBelongsToCampaignId
getEstimate
getId
getKeywordContentMaxCpc
getKeywordMaxCpc
getMaxCpa
getName
getProxyKeywordMaxCpc
getSiteMaxCpc
getSiteMaxCpm
getStatus
setKeywordContentMaxCpc
setKeywordMaxCpc
setMaxCpa
setName
setSiteMaxCpc
setSiteMaxCpm
setStatus
toXml

Class Operations

addAdGroup
addAdGroupList
addAdGroupsOneByOne
createAdGroupObject
getActiveAdGroups
getAdGroupList
getAllAdGroups
removeAdGroup
APIlity uses these native API AdGroup functions.
These function are defined in the AdGroup Service WSDL.

Object Operations

Class Operations

Criterion.php

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

Object Operations

getBelongsToAdGroupId
getCriterionData // KeywordCriterion object
getCriterionData // WebsiteCriterion object
getCriterionStats
getCriterionType
getDestinationUrl
getEstimate
getFirstPageCpc
getId
getIsNegative
getIsPaused
getLanguage
getMaxCpc // KeywordCriterion
getMaxCpc // WebsiteCriterion
getMaxCpm
getProxyMaxCpc
getQualityScore
getStatus
getText
getType
getUrl
setDestinationUrl
setIsNegative
setIsPaused
setLanguage
setMaxCpc
setMaxCpm
setText
setType
setUrl
toXml

Class Operations

addKeywordCriteriaOneByOne
addKeywordCriterion
addKeywordCriterionList
addWebsiteCriteriaOneByOne
addWebsiteCriterion
addWebsiteCriterionList
checkCriterionList
createCriterionObject
getAllCriteria
getCriterionList
getCriterionListStats
removeCriterion
removeCriterionList
updateCriterionList
APIlity uses these native API Criterion functions.
These function are defined in the Criterion Service WSDL.

Object Operations

Class Operations

checkCriterionList($criteria, $languages, $geoTargets)
Checks a list of Criteria for policy errors.
Parameters:
[Criterion] criteria
[String] languages
geoTargets = 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:
[ApiError] criteriaCheck

Sample:
$criterion1 = array(
  
'text' => "test1",
  
'type' => "Broad",
  
'isNegative' => false,
  
'maxCpc' => 1.0,
  
'language' => "de",
  
'destinationUrl' => "http://groups.google.com/group/adwords-api-php"
);
$criterion2 = array(
  
'text' => "test2",
  
'type' => "Exact",
  
'isNegative' => false,
  
'maxCpc' => 1.0,
  
'language' => "de",
  
'destinationUrl' => "http://groups.google.com/group/adwords-api-php"
);
$geoTargets = array(
  
'countryTargets' => array(
    
'countries' => array()
  ),
  
'regionTargets' => array(
    
'regions' => array()
  ),
  
'metroTargets' => array(
    
'metros' => array()
  ),
  
'cityTargets' => array(
    
'cities' => array(
      
"Grenoble, V FR"
    
)
  ),
  
'proximityTargets' => array(
    
'circles' => array()
  )
);
$languages = array('de''fr''en');
print_r(
  
checkCriterionList(
    array(
$criterion1$criterion2),
    
$languages,
    
$geoTargets
  
)
); 

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

Ad.php

Quicknavigatior Back To Top APIlity Home   APIlity Forum
» Campaign  |  » AdGroup  |  » Criterion  |  » Ad  |  » Report  |  » KeywordTool  |  » SiteSuggestion  |  » TrafficEstimate  |  »  |  » Info

Object Operations

getAdData // CommerceAd objects
getAdData // ImageAd object
getAdData // LocalBusinessAd objects
getAdData // MobileAd object
getAdData // TextAd object
getAdData // VideoAd objects
getAdStats
getAdType
getAddress
getBelongsToAdGroupId
getBusinessImage
getBusinessKey
getBusinessName
getCity
getCountryCode
getCustomIcon
getCustomIconId
getDescription
getDescription1
getDescription2
getDestinationUrl
getDisplayUrl
getFullBusinessName
getHeadline
getId
getImage
getIsDisapproved
getLatitude
getLongitude
getMarkupLanguages
getMobileCarriers
getName
getPhoneNumber
getPostPriceAnnotation
getPostalCode
getP