$optParams = array(
'dimensions' => 'ga:country,ga:city', // 'ga:country,ga:browser',
'max-results' => '150',
'sort' => 'ga:country',
'filters' => 'ga:country=@a'
);
$ids = 'ga:41516807';
$startDate = '2018-08-09';
$endDate = '2018-08-16';
$metrics = 'ga:users';
return $analytics->data_ga->get($ids, $startDate, $endDate, $metrics, $optParams);
En la función printResults:
if (count($results->getRows()) > 0) {
$profileName = $results->getProfileInfo()->getProfileName();
$rows = $results->getRows();
foreach ($rows as $sclave=>$valor) {
echo $valor[0]." Ciudad: ".$valor[1]." Visitas: ".$valor[2];
echo "<br>";
}
} else {
print "No results found.\n";
}
No hay comentarios:
Publicar un comentario