// Added realtime Analytics to the dashboard (private beta only at this time)

This commit is contained in:
Damien Metzger
2013-09-11 14:07:56 +02:00
parent 937ce38a1f
commit 981ce70594
2 changed files with 25 additions and 22 deletions
+3 -2
View File
@@ -73,7 +73,7 @@ class Gapi extends Module
return $html.$this->api_3_0_getContent();
}
public function requestReportData($dimensions, $metrics, $date_from, $date_to, $sort = null, $filters = null, $start = 1, $limit = 30)
public function requestReportData($dimensions, $metrics, $date_from = null, $date_to = null, $sort = null, $filters = null, $start = 1, $limit = 30)
{
// You can switch to the 1.3 API by replacing the following function call by $this->api_1_3_requestReportData()
return $this->api_3_0_requestReportData($dimensions, $metrics, $date_from, $date_to, $sort, $filters, $start, $limit);
@@ -326,7 +326,8 @@ class Gapi extends Module
'timeout' => 5,
)
));
if (!$response_json = Tools::file_get_contents('https://www.googleapis.com/analytics/v3/data/ga?'.$content, false, $stream_context))
$api = ($date_from && $date_to) ? 'ga' : 'realtime';
if (!$response_json = Tools::file_get_contents('https://www.googleapis.com/analytics/v3/data/'.$api.'?'.$content, false, $stream_context))
return false;
// https://developers.google.com/analytics/devguides/reporting/core/v3/reference