Hourly data access from the Google Analytics API and gapi.class.php

I use the gapi class to access analytics data. It works great, and I have daily visits to my site. I would like to be able to visit the date range hourly, say, from January 11 to January 12 (2 days), which will return me 48 data points, one for every hour in the range. I am sure it is simple, but I cannot find how to do it anywhere. Presumably, there is some setting in the metrics parameter of the requestReportData () method, which allows this

Any help gratefully received, thanks ...

David

+4
source share
1 answer

For this you need to set two dimensions

Dimensions: ga:hour, ga:date Metric: ga:visits 

You can check this query in the Google Analytics API Query Explorer.

Unconfirmed, it should look like this: gapi.class.php:

 $ga->requestReportData($profile_id,array('hour','date'),array('visits'), null, null, '2011-01-11', '2011-01-12', 1, 48); 

You will get back data that looks like this: enter image description here

+9
source

Source: https://habr.com/ru/post/1337575/


All Articles