setApplicationName("Client_Library_Examples"); $key = file_get_contents($key_file_location); // seproate additional scopes with a comma $scopes ="https://www.googleapis.com/auth/analytics.readonly"; $cred = new Google_Auth_AssertionCredentials($Email_address, array($scopes), $key); $client->setAssertionCredentials($cred); if($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWithAssertion($cred); } $service = new Google_Service_Analytics($client); //Adding Dimensions $params = array('dimensions' => 'ga:userType'); // requesting the data $data = $service->data_ga->get("ga:89798036", "2014-12-14", "2014-12-14", "ga:users,ga:sessions", $params ); ?> Results for date: 2014-12-14
getColumnHeaders() as $header){ print ""; } ?> getRows() as $row) { print ""; } ?> Source code for this file can be found at Source
".$header['name']."
".$row[0]."".$row[1]."".$row[2]."
Rows Returned getTotalResults();?>