Posted in PHP
$filter = 'browser == Firefox || browser == Chrome && ga:pagePath=~/java/'; $ga->requestReportData(ga_profile_id,array('browser', 'pagePath'),array('visits'),'-visits',$filter);Nb: filter di atas dipersingkat, silakan disesuaikan dengan kebutuhan anda. Hasil akhir kurang lebih seperti gambar berikut: [caption id="" align="aligncenter" width="452"] Visitor by path and browser[/caption] Source code lengkap:
<?php define('ga_email','email'); define('ga_password','pass'); define('ga_profile_id','id_profile'); require 'gapi.class.php'; $ga = new gapi(ga_email,ga_password); $filter = 'browser == Firefox || browser == Chrome || browser == Opera || browser == Safari || browser == Internet Explorer && ga:pagePath=~/java/'; $ga->requestReportData(ga_profile_id,array('browser', 'pagePath'),array('visits'),'-visits',$filter); ?> <table> <tr> <th>Browser</th> <th>page Path</th> <th>Visits</th> </tr> <?php foreach($ga->getResults() as $result): ?> <tr> <td><?php echo $result ?></td> <td><?php echo $result->getPagePath() ?></td> <td><?php echo $result->getVisits() ?></td> </tr> <?php endforeach ?> </table> <table> <tr> <th>Total Results</th> <td><?php echo $ga->getTotalResults() ?></td> </tr> <tr> <th>Total Visits</th> <td><?php echo $ga->getVisits() ?></td> </tr> <tr> <th>Results Updated</th> <td><?php echo $ga->getUpdated() ?></td> </tr> </table>Sekian tutorial Google Analytics API berdasarkan URI. Semoga bermanfaat.