A couple of issues with google-api-php-client Adsense examples

36 views
Skip to first unread message

Raúl Mellado

unread,
Mar 1, 2012, 2:23:01 AM3/1/12
to adsen...@googlegroups.com
   Hi Silvano,

   I have been going through all examples in google-api-php-client (v 0.4.9 beta), and this is what I have found:

   1. In GetAllCustomChannels, I was getting the names for the custom channels, but not the ids, checking your code you have $customChannel['productCode'] (#47), but with a var_dump I saw that the property is called "code", so I changed $customChannel['productCode'] to $customChannel['code'] and the id was shown then.

   2. There are 2 examples not working for me, these are:GetAllAdUnitsForCustomChannel and GetAllCustomChannelsForAdUnit.

    I have replaced:

    define('CUSTOM_CHANNEL_ID', 'my channel id here');
    define('AD_UNIT_ID', 'my ad unit id here');

    with values coming from requests using the API, to get all channel ids/ad unit ids

   Maybe I am doing something wrong here?


   The rest of examples work beautifully for me, thanks for the great code, it is priceless!

   Cheers!


   Raul

Silvano Luciani

unread,
Mar 1, 2012, 8:19:51 AM3/1/12
to AdSense API Forum
Hello Raúl,

Thanks for notifying us of 1, I will fix it ASAP!

For GetAllAdUnitsForCustomChannel and GetAllCustomChannelsForAdUnit
you need to pass the account ID and ad client ID:
http://code.google.com/p/google-api-php-client/source/browse/trunk/examples/adsense/examples/GetAllAdUnitsForCustomChannel.php#31

You can use the 'Get All Accounts' example to retrieve your account ID/
s and 'Get All Ad Clients' to retrieve your Ad Client/s.

Cheers,
Silvano

--
Silvano Luciani | Developer Programs Engineer

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London
SW1W 9TQ
Registered in England Number: 3977902
Reply all
Reply to author
Forward
0 new messages