I'm using Google Analytics Client Api(https://github.com/google/google-api-php-client.git) to get the pageviews. It worked when I tried to get data from 7daysAgo to today, my code is:
function getResults(&$analytics, $profileId) {
return $analytics->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:visits',
array(
'filters' => 'ga:pagePath==/project_z2o/',
'dimensions' => 'ga:pagePath',
'metrics' => 'ga:pageviews',
'sort' => '-ga:pageviews',
'max-results' => '25'
));
}
but now, I want to get the data of the last previous hour. ex: current time is: 01-15-2016 11:49:50 and I run my code. I want to get the pageviews between 01-15-2016 10:49:50 and 01-15-2016 11:49:50. How can I get it. Please help. Thanks.