Class AdWordAdGroupService

Description

AdWords Lib AdGroup Class

Use this class to work with Google AdWords AdGroup Service. AdGroupService provides operations for accessing, modifying, and creating AdGroups

Located in /services/AdWordAdGroupService.inc

AdWordService
   |
   --AdWordAdGroupService
Method Summary
 AdWordAdGroupService AdWordAdGroupService (string $soapToolkit)
 object|false addAdGroup (int $campaignID, object AdWordAdGroup $newAdGroup, [string $clientEmail = ''])
 array|false addAdGroupList (int $campaignID, array $newAdGroups, [string $clientEmail = ''])
 object|false getAdGroup (int $adGroupId, [string $clientEmail = ''])
 array|false getAdGroupList (array $adgroupIDs, [string $clientEmail = ''])
 array|false getAdGroupStats (int $campaignId, array $adGroupIds, string $start, string $end, [string $clientEmail = ''])
 array|false getAllAdGroups (int $campaignID, [string $clientEmail = ''])
 array|false getAllChangedAdGroups (int $campaignID, string $since, [string $clientEmail = ''])
 bool updateAdGroup (object AdWordAdGroup $adGroup, [string $clientEmail = ''])
 bool updateAdGroupList (array $adGroups, [string $clientEmail = ''])
Methods

AdWordAdGroupService Constructor. It takes one parameter - name of a supported by AdWords Lib SOAP toolkit

Example:

  1.  <?php
  2.  ?>
Please use defined constants for supported by AdWords Lib toolkit names

AdWordAdGroupService AdWordAdGroupService (string $soapToolkit)
  • string $soapToolkit: name of a supported by AdWords Lib SOAP Toolkit

Adds a new AdGroup to a Campaign.

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$campaignID - ID of the Campaign to which new AdGroup will be added
  4.  //$newAdGroup is an object of class AdWordAdGroup
  5.  $response $adgroupService->addAdGroup($campaignID$newAdGroup);
  6.  if ($response === false// if an error appears
  7.          $errr $classKW->getLastError()//get error object
  8.          echo $errr->toString()//output error
  9.          exit();
  10.  }
  11.  //$response is an object of class AdWordAdGroup which holds the new
  12.  //created AdGroup
  13.  ?>

object|false addAdGroup (int $campaignID, object AdWordAdGroup $newAdGroup, [string $clientEmail = ''])
  • int $campaignID: ID of the Campaign to which new AdGroup will be added
  • object AdWordAdGroup $newAdGroup: an object of class AdWordAdGroup
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Adds new AdGroups to a Campaign.

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$campaignID - ID of the Campaign to which new AdGroups will be added
  4.  //$adgroup1, $adgroup2 are objects of class AdWordAdGroup
  5.  $newAdGroups array($adgroup1$adgroup2);
  6.  $response $adgroupService->addAdGroupList($campaignID$newAdGroups);
  7.  if ($response === false// if an error appears
  8.          $errr $classKW->getLastError()//get error object
  9.          echo $errr->toString()//output error
  10.          exit();
  11.  }
  12.  //$response is an array of objects of class AdWordAdGroup which
  13.  //holds the new created AdGroups
  14.  ?>

array|false addAdGroupList (int $campaignID, array $newAdGroups, [string $clientEmail = ''])
  • int $campaignID: ID of the Campaign to which new AdGroups will be added
  • array $newAdGroups: array of objects of class AdWordAdGroup
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns all information about the specified AdGroup

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$adgroupId - AdGroup's ID
  4.  $response $adgroupService->getAdGroup($adgroupId);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response is an object of class AdWordAdGroup
  11.  ?>

object|false getAdGroup (int $adGroupId, [string $clientEmail = ''])
  • int $adGroupId: ID of the AdGroup
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns a list of AdGroups

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$adgroupId1, $adgroupId2 - AdGroups' IDs
  4.  $adgroupIDs array($adgroupId1$adgroupId2);
  5.  $response $adgroupService->getAdGroupList($adgroupIDs);
  6.  if ($response === false// if an error appears
  7.          $errr $classKW->getLastError()//get error object
  8.          echo $errr->toString()//output error
  9.          exit();
  10.  }
  11.  //$response is an array of objects of class AdWordAdGroup
  12.  ?>

array|false getAdGroupList (array $adgroupIDs, [string $clientEmail = ''])
  • array $adgroupIDs: array of adGroups' IDs
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Gets statistics for a list of ad groups in a Campaign for a period of time

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$campaignID - ID of the Campaign
  4.  //$adgroup1, $adgroup2 are objects of class AdWordAdGroup
  5.  $adGroupIds array($adgroup1$adgroup2);
  6.  $start '2005-01-01T00:00:00Z';
  7.  $end '2005-02-01T00:00:00Z';
  8.  $response $adgroupService->getAdGroupStats($campaignID$adGroupIds$start$end);
  9.  if ($response === false// if an error appears
  10.          $errr $classKW->getLastError()//get error object
  11.          echo $errr->toString()//output error
  12.          exit();
  13.  }
  14.  //$response is an array of objects of class AdWordStatsRecord
  15.  ?>

array|false getAdGroupStats (int $campaignId, array $adGroupIds, string $start, string $end, [string $clientEmail = ''])
  • int $campaignId: ID of the Campaign
  • array $adGroupIds: array of AdGroups' IDs
  • string $start: beginning of the period
  • string $end: end of of the period
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns all AdGroups from a Campaign. If there are no AdGroups in this Campaign, an empty array will be returned

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$campaignID - ID of the Campaign
  4.  $response $adgroupService->getAllAdGroups($campaignID);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response is an array of objects of class AdWordAdGroup
  11.  ?>

array|false getAllAdGroups (int $campaignID, [string $clientEmail = ''])
  • int $campaignID: ID of the Campaign
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Removed from AdWords API.

Returns all changed AdGroups from a Campaign. If there are no AdGroups in this Campaign, an empty array will be returned

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$campaignID - ID of the Campaign
  4.  $since '2005-01-01T00:00:00Z';
  5.  $response $adgroupService->getAllChangedAdGroups($campaignID$since);
  6.  if ($response === false// if an error appears
  7.          $errr $classKW->getLastError()//get error object
  8.          echo $errr->toString()//output error
  9.          exit();
  10.  }
  11.  //$response is an array of objects of class AdWordAdGroup
  12.  ?>

array|false getAllChangedAdGroups (int $campaignID, string $since, [string $clientEmail = ''])
  • int $campaignID: ID of the Campaign
  • string $since: beginning of the period
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Updates the fields of an existing AdGroup

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$adgroup is an object of class AdWordAdGroup
  4.  $response $adgroupService->updateAdGroup($adgroup);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response == true
  11.  ?>

bool updateAdGroup (object AdWordAdGroup $adGroup, [string $clientEmail = ''])
  • object AdWordAdGroup $adGroup: object of class AdWordAdGroup
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Updates the fields of multiple existing AdGroups

Example:

  1.  <?php
  2.  $adgroupService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$adgroup1, $adgroup2 are objects of class AdWordAdGroup
  4.  $adGroups array($adgroup1$adgroup2);
  5.  $response $adgroupService->updateAdGroupList($adGroups);
  6.  if ($response === false// if an error appears
  7.          $errr $classKW->getLastError()//get error object
  8.          echo $errr->toString()//output error
  9.          exit();
  10.  }
  11.  //$response == true
  12.  ?>

bool updateAdGroupList (array $adGroups, [string $clientEmail = ''])
  • array $adGroups: array of objects of class AdWordAdGroup
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Inherited Methods

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:12 +0300 by phpDocumentor 1.3.2