Tuesday, April 25, 2017

Digest for adsense-api@googlegroups.com - 4 updates in 1 topic

Francesco Pepe <sgozzapolli@gmail.com>: Apr 24 10:15AM -0700

I'm trying to make batch requests using multiple metrics as follows:
 
$this->client->setUseBatch(true);
 
 
$service = new Google_Service_AdSense($this->client);
$batch = $service->createBatch();
 
$optParams = array(
'metric' => ['EARNINGS','CLICKS'],
'dimension' => $dimensions
);
 
$req1 = $service->accounts_reports->generate( $accountId,
date('Y-m-d',
strtotime($widget->settings->date->startDate) ),
date('Y-m-d',
strtotime($widget->settings->date->endDate) ),
$optParams);
 
$req2 = $service->accounts_reports->generate( $accountId,
date('Y-m-d',
strtotime($compare['startDate']) ),
date('Y-m-d',
strtotime($compare['endDate']) ),
$optParams);
 
$batch->add($req1, "thoreau");
$batch->add($req2, "shaw");
 
$results = $batch->execute();
 
 
This requests always return: This is an empty report: no dimensions or
metrics were provided.
 
So it's impossible to make batch requests using multiple metrics?
"Dean Lukies (Adsense API Team)" <adsenseapiadvisor+lukiesd@google.com>: Apr 24 10:20AM -0700

Hi,
 
I recommend that you do not use the Batch request with the AdSense API.
Although it may work in some instances, it does not work well for reporting.
 
thanks,
Dean
 
On Monday, April 24, 2017 at 1:16:52 PM UTC-4, Francesco Pepe wrote:
Francesco Pepe <sgozzapolli@gmail.com>: Apr 24 12:40PM -0700

Hi Dean,
 
I have tested with javascript client libraries it works well, with php
libraries seems buggy.
 
Can I ask you why it is not recommended?
 
Il giorno lunedì 24 aprile 2017 19:16:52 UTC+2, Francesco Pepe ha scritto:
"Dean Lukies (Adsense API Team)" <adsenseapiadvisor+lukiesd@google.com>: Apr 24 12:50PM -0700

Hi,
 
Not recommended as it doesn't work with some libraries and it still counts
as multiple requests for purposes of quota.
 
If you want to talk about your particular use case, I would love to hear
about it offline, you can write in to adsenseapi-support@google.com
 
thanks,
Dean
 
On Monday, April 24, 2017 at 3:44:25 PM UTC-4, Francesco Pepe wrote:
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to adsense-api+unsubscribe@googlegroups.com.

Friday, April 14, 2017

Digest for adsense-api@googlegroups.com - 1 update in 1 topic

"Dean Lukies (Adsense API Team)" <adsenseapiadvisor+lukiesd@google.com>: Apr 13 07:19AM -0700

Hi,
 
can you tell me which Language you are using (e.g. PHP, Java) and if you
updated the client library?
 
thanks,
Dean
 
On Sunday, March 5, 2017 at 5:22:53 AM UTC-5, sorry chou wrote:
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to adsense-api+unsubscribe@googlegroups.com.