Skip to content

AdManager migration

Thang Duong edited this page Aug 21, 2018 · 2 revisions

DFP to Ad Manager rebrand guide

Overview

DoubleClick for Publishers was recently renamed to Google Ad Manager. To be consistent with these changes, we've updated our example code and refactored type names throughout this library.

What changed?

  • The adsapi_php.ini configuration file had the DFP section renamed to AD_MANAGER.
  • Namespace changes:
Before After
Google\AdsApi\Dfp Google\AdsApi\AdManager
Google\AdsApi\Dfp\Util Google\AdsApi\AdManager\Util
  • Class name changes:
Before After
DfpGuzzleLogMessageFormatterProvider AdManagerGuzzleLogMessageFormatterProvider
DfpHeaderHandler AdManagerHeaderHandler
DfpServiceDescriptor AdManagerServiceDescriptor
DfpServices AdManagerServices
DfpSession AdManagerSession
DfpSessionBuilder AdManagerSessionBuilder
DfpSoapLogMessageFormatterProvider AdManagerSoapLogMessageFormatterProvider
DfpDateTimes AdManagerDateTimes
DfpDates AdManagerDates

Note: The Packagist name is not changing and will continue to be googleads/googleads-php-lib.

How to migrate

  1. Update your adsapi_php.ini configuration file to rename the [DFP] section renamed to [AD_MANAGER]. The new structure of the file should look like:
[AD_MANAGER]
; Required Ad Manager API properties. Details can be found at:
; https://developers.google.com/ad-manager/docs/soap_xml
networkCode = "INSERT_NETWORK_CODE_HERE"
applicationName = "INSERT_APPLICATION_NAME_HERE"

; Optional additional Ad Manager API settings.
; endpoint = "https://ads.google.com/"

[OAUTH2]
...

[SOAP]
...

[CONNECTION]
...

[LOGGING]
...

Failure to make this change will cause an error like:

Fatal error: Uncaught InvalidArgumentException: Network code is required. in Google/AdsApi/AdManager/AdManagerSessionBuilder.php on line 358

This error is due to the fact that the AdManagerSessionBuilder class expects the network code to be present under the new [AD_MANAGER] section in the adsapi_php.ini file.

  1. Change the use statements of the Dfp namespace to AdManager. You also need to use the new class names in all code references. For example:
use Google\AdsApi\AdManager\AdManagerSession;
use Google\AdsApi\AdManager\AdManagerSessionBuilder;
use Google\AdsApi\AdManager\v201808\ServiceFactory;

Failure to make this change will cause an error like:

PHP Fatal error:  Uncaught Error: Class 'Google\AdsApi\Dfp\DfpSessionBuilder' not found

This error is due to the fact that the classes and their namespaces have changed. Please refer to the list of namespace and class name changes above.

For questions about this or any other API changes, reach out to us on the Ad Manager API forums.