Class awAdGroupAdService

Description

AdWords Lib Ad Class

Service for managing AdGroupAd entities. AdGroupAds maintain the relationships between AdGroups and Ads.

Located in /services/AdGroupAdService.php

awService
   |
   --awAdGroupAdService
Method Summary
 awAdGroupAdService awAdGroupAdService ([boolean $useSandbox = false])
 awAdGroupAdReturnValue addAds ( $ads, [string $clientEmail = ''], array $newAds)
 awAdGroupAdPage get (awAdGroupAdSelector $adSelector, [ $clientEmail = ''])
 awAdGroupAdPage getActiveAds (array $adGroupIds, [string $clientEmail = ''])
 awAdGroupAdPage getAd (int $adGroupId, int $adId, [string $clientEmail = ''])
 awAdGroupAdPage getAdStats (int $adGroupId, int $adIds, int $startDay, int $endDay, [string $clientEmail = ''])
 awAdGroupAdPage getAllAds (array $adGroupIds, [string $clientEmail = ''])
 awAdGroupAdReturnValue mutate (array $adGroupOperations, [ $clientEmail = ''])
 awAdGroupAdReturnValue updateAds (array $ads, [string $clientEmail = ''])
 void _getServiceHeaders ([ $clientEmail = ''])
Methods

awAdGroupAdService Constructor

Example:

  1.  <?php
  2.  $adService new awAdGroupAdService();
  3.  ?>

awAdGroupAdService awAdGroupAdService ([boolean $useSandbox = false])
  • boolean $useSandbox: should we use the sandbox

Make a batch of new Ads.

The adGroupId field of the Ad indicates which AdGroup to add the Ad to. The adGroupId field is required, and the indicated AdGroup must exist already. The Ad's id and disapproved fields are set by the AdService -- if you fill them in they will be ignored. By default, Ads are enabled and will be served as soon as they are created. You can set the status field on the ad to either paused or disabled to prevent the ad from being active.

Example:

  1.  <?php
  2.  $adService new awAdGroupAdService();
  3.  $adService->setTokens($authToken$developerToken);
  4.  //$newAds is an array of objects of class awAd or any of its descendants
  5.  $response $adService->addAds($newAds);
  6.  //$response is an array of objects of class awAd
  7.  ?>

awAdGroupAdReturnValue addAds ( $ads, [string $clientEmail = ''], array $newAds)
  • array $newAds: array of objects of class awAdGroupAd
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account
  • $ads

Returns a list of AdGroupAds based on an AdGroupAdSelector. The selector defines a specific set of AdGroupAds that are to be returned - an AdGroupAd must pass all the filters specified in the argument AdGroupAdSelector

awAdGroupAdPage get (awAdGroupAdSelector $adSelector, [ $clientEmail = ''])

Return all active Ads associated with the list of AdGroup ids specified.

Example:

  1.  <?php
  2.  $adService new awAdGroupAdService();
  3.  $adService->setTokens($authToken$developerToken);
  4.  $response $adService->getActiveAds($adGroupIds);
  5.  //$response is an array of objects of class awAd
  6.  ?>

awAdGroupAdPage getActiveAds (array $adGroupIds, [string $clientEmail = ''])
  • array $adGroupIds: An array of AdGroup Ids that own the Ads
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Return information about one Ad.

Example:

  1.  <?php
  2.  $adService new awAdGroupAdService();
  3.  $adService->setTokens($authToken$developerToken);
  4.  $response $adService->getAd($adGroupId$adId);
  5.  //$response is an array of objects of class awAd
  6.  ?>

awAdGroupAdPage getAd (int $adGroupId, int $adId, [string $clientEmail = ''])
  • int $adGroupId: The ID of the AdGroup owning the Ad
  • int $adId: The ID of the Ad
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Get statistics for a list of ads in an ad group.

The time granularity is one day.

Example:

  1.  <?php
  2.  $adService new awAdGroupAdService();
  3.  $adService->setTokens($authToken$developerToken);
  4.  $response $adService->getAdStats($adGroupId$adIds$startDay$endDaytrue);
  5.  //$response is an object of class awAdGroupAdPage
  6.  ?>

awAdGroupAdPage getAdStats (int $adGroupId, int $adIds, int $startDay, int $endDay, [string $clientEmail = ''])
  • int $adGroupId: The ID of the AdGroup owning the Ad
  • int $adIds: The ads to query
  • int $startDay: The starting day of the period for which statistics are to be collected (xsd:date)
  • int $endDay: The ending day of the period for which statistics are to be collected, inclusive (xsd:date)
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Return all Ads (enabled, disabled, or paused) associated with the list of AdGroup ids specified.

Example:

  1.  <?php
  2.  $adService new awAdGroupAdService();
  3.  $adService->setTokens($authToken$developerToken);
  4.  $response $adService->getAllAds($adGroupIds);
  5.  //$response is an array of objects of class awAd
  6.  ?>

awAdGroupAdPage getAllAds (array $adGroupIds, [string $clientEmail = ''])
  • array $adGroupIds: An array of AdGroup Ids that own the Ads
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Applies the list of mutate operations (ie. add, set, remove)

awAdGroupAdReturnValue mutate (array $adGroupOperations, [ $clientEmail = ''])

Update a batch of ads.

Use the id field of the ad to indicate which ad to update. Currently only the status field is updateable, all other fields will be ignored.

Example:

  1.  <?php
  2.  $criterionService new awAdGroupAdService();
  3.  $criterionService->setTokens($authToken$developerToken);
  4.  //$ad1, $ad2 is an object of class awAd or any of its descendants
  5.  $ads array($ad1$ad2);
  6.  $response $criterionService->updateAds($ads);
  7.  //$response == true
  8.  ?>

awAdGroupAdReturnValue updateAds (array $ads, [string $clientEmail = ''])
  • array $ads: array of objects of class awAdGroupAd
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account
void _getServiceHeaders ([ $clientEmail = ''])
  • $clientEmail

Inherited Methods

Inherited From awService

 awService::__construct()
 awService::callService()
 awService::checkArray()
 awService::checkArrayOf()
 awService::checkObjectOf()
 awService::getAccount()
 awService::getClientCustomerId()
 awService::getClientEmail()
 awService::getResponseHeaders()
 awService::getToolkit()
 awService::setAccount()
 awService::setClientCustomerId()
 awService::setClientEmail()
 awService::setTokens()
 awService::setUserAgent()
 awService::_getServiceHeadersV2009()
 awService::_returnResponseAsArrayOf()
 awService::_returnResponseAsObjectOf()

Documentation generated on Thu, 15 Apr 2010 19:06:07 +0300 by phpDocumentor 1.4.3