But still I got this issue:
Fatal error: Uncaught exception 'Google_Exception' with message '(get) missing required param: 'ids'' in /home/sample/www/test/google-api-php-client-master/src/Google/Service/Resource.php:163 Stack trace: #0 /home/sample/www/test/google-api-php-client-master/src/Google/Service/Analytics.php(2107): Google_Service_Resource->call('get', Array, 'Google_Service_...') #1 /home/sample/www/test/google-api-php-client-master/practicein.php(57): Google_Service_Analytics_DataRealtime_Resource->get('ga:********', 'ga:pageviews', '2015-03-07', '2015-04-04') #2 /home/sample/www/test/index.php(34): require_once('/home/lanforest...') #3 {main} thrown in /home/sample/www/test/google-api-php-client-master/src/Google/Service/Resource.php on line 163
And I think the codes around here is wrong.
$results = $analytics->data_realtime->get(
$analytics_view_id,
'ga:pageviews',//**I did correct this.**
'2015-03-07',
'2015-04-04'
);
//**I think these goes wrong**
$totals = $results->getTotalsForAllResults();
$array = array("activeUsers" => $totals["rt:activeUsers"]);
I want to see just page views. What can I code?
I think I got active user value.But,It still warning. What kind of error is this?
Warning: Cannot modify header information - headers already sent by (output started at /home/sample/www/test/index.php:16) in /home/sample/www/test/google-api-php-client-master/practicein.php on line 76
Warning: Cannot modify header information - headers already sent by (output started at /home/sample/www/test/index.php:16) in /home/sample/www/test/google-api-php-client-master/practicein.php on line 77
{"activeUsers":"0"}//this is the result.