Group: http://groups.google.com/group/adsense-api/topics
- Authen by Service Account Error [1 Update]
- AdSense Management API v1.3 has launched! [1 Update]
- Stats VNG <stats.vng@gmail.com> Aug 30 12:37AM -0700
Hi all,
require_once dirname(__FILE__).'/google-api-php-client/Google_Client.php';
require_once dirname(__FILE__).'/google-api-php-client/contrib/Google_AdSenseService.php';
require_once dirname(__FILE__).'/google-api-php-client/contrib/Google_Oauth2Service.php';
$SERVICE_ACCOUNT_PKCS12_FILE_PATH = dirname(__FILE__).'/keyfile.p12';
// create client object and set app name
$client = new Google_Client();
$client->setApplicationName("XXXX"); // name of your app
// set assertion credentials
$key = file_get_contents($SERVICE_ACCOUNT_PKCS12_FILE_PATH);
$auth = new Google_AssertionCredentials(
"YYYYYY@developer.gserviceaccount.com", // email you added to GA
array('https://www.googleapis.com/auth/adsense.readonly'),
$key);
$client->setAssertionCredentials($auth);
$client->getAuth()->refreshTokenWithAssertion();
$accessToken = $client->getAccessToken();
// other settings
$client->setClientId("XYZ.apps.googleusercontent.com"); // from API console
$service = new Google_AdsenseService($client);
$optParams = array('metric' => array('earnings'), 'dimension' => 'date');
$data = $service -> reports -> generate('2013-01-01', '2013-03-03', $optParams);
But I got the error messege : (403) User does not have an AdSense account
Please help me!!
- Eduardo Scoz <eduardoscoz@gmail.com> Aug 29 12:55PM -0700
Hi Sergio, thanks for the great news!
I'm testing the alerts functionality, is there any way to generate "test"
alerts, so we can develop against it? The accounts I have access to do not
currently have any alerts.
Also, what's the distinction between alerts and the "messages" inbox that
exist in AdSense today? Seems like messages are not available thru the API
is that correct?
Thank you,
Eduardo Scoz
QuickAdsense developer
On Tuesday, June 18, 2013 6:10:23 AM UTC-7, Sérgio Gomes (AdSense API Team)
wrote:
You received this message because you are subscribed to the Google Groups "AdSense API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adsense-api+unsubscribe@googlegroups.com.
To post to this group, send email to adsense-api@googlegroups.com.
Visit this group at http://groups.google.com/group/adsense-api.
For more options, visit https://groups.google.com/groups/opt_out.
If you are looking into earning money from your visitors by popup ads - you can try one of the most reputable companies: Clicksor.
ReplyDelete