Migration Error from DFP(v201805) to Ad Manger(v201811)

85 views
Skip to first unread message

jnmj...@gmail.com

unread,
Dec 14, 2018, 7:22:46 AM12/14/18
to Google Ad Manager API Forum

Hi,

Now, we are migrating DFP to Ad manger in our application for DFP Premium account, previously we have used v201805 version on nornal account and now updating to v201811.

As per Ad manager we have configured our environment but getting below error so please help ASAP.


PHP Warning:  The use statement with non-compound name 'DateTime' has no effect in /prod/html/tools/dfpapi/googleads-php-lib/examples/Dfp/v201811/ReportService/AdEx_jagran_report.php on line 36
PHP Warning:  The use statement with non-compound name 'DateTimeZone' has no effect in /prod/html/tools/dfpapi/googleads-php-lib/examples/Dfp/v201811/ReportService/AdEx_jagran_report.php on line 37
PHP Warning:  The use statement with non-compound name 'UnexpectedValueException' has no effect in /prod/html/tools/dfpapi/googleads-php-lib/examples/Dfp/v201811/ReportService/AdEx_jagran_report.php on line 55
PHP Fatal error:  Uncaught InvalidArgumentException: Network code is required. in /prod/html/tools/dfpapi/googleads-php-lib/src/Google/AdsApi/Dfp/AdManagerSessionBuilder.php:350
Stack trace:
#0 /prod/html/tools/dfpapi/googleads-php-lib/src/Google/AdsApi/Dfp/AdManagerSessionBuilder.php(303): Google\AdsApi\Dfp\AdManagerSessionBuilder->validate()
#1 /prod/html/tools/dfpapi/googleads-php-lib/examples/Dfp/v201811/ReportService/AdEx_jagran_report.php(318): Google\AdsApi\Dfp\AdManagerSessionBuilder->build()
#2 /prod/html/tools/dfpapi/googleads-php-lib/examples/Dfp/v201811/ReportService/AdEx_jagran_report.php(327): RunSavedQuery::main()
#3 {main}
  thrown in /prod/html/tools/dfpapi/googleads-php-lib/src/Google/AdsApi/Dfp/AdManagerSessionBuilder.php on line 350


Thanks & Regards

Abhay Mishra

Sr. Manager - Technology

Jagran New Media


Sreelakshmi Sasidharan (DFP API Team)

unread,
Dec 14, 2018, 2:46:00 PM12/14/18
to Google Ad Manager API Forum
Hello,

To properly migrate your internal jobs from v201711 API version to v201811 API version, please take note of the following steps:

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.

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.

You can refer to this complete guide in Java for more information. For other languages, let me know what language you are using so I can provide you the correct migration guide that you can follow.


Regards,
Sreelakshmi Sasidharan, Ad Manager API Team
Reply all
Reply to author
Forward
0 new messages