<?php
include( 'gapi.class.php'); // include the path to the gapi class
define('ga_email','youremail@email.com'); // enter your username and password.
define('ga_password','your password');
$ga = new gapi(ga_email,ga_password);
$report_id = 'enter your id';
$filter = 'ga:pagePath==/page-path.php';
$start_date = 'YYYY-MM-DD'; // example: 2011-01-31
// if you leave $end_date as null, it's today's date
// you may create variables for each parameter value or enter them into the parenthesis directly.
$ga->requestReportData(
$report_id, // $report_id
array('pagePath'), // $dimensions
array('UniquePageviews'), // $metrics
'-UniquePageviews', // $sort_metric
$filter, // $filter
$start_date, // $start_date
null, // $end_date
1, // $start_index
null // $max_results
);
foreach($ga->getResults() as $result) {
$pageview = $result->getUniquePageviews();
echo 'path: '.$result->getPagePath().'<br/>';
echo $pageview." unique views";
}
?>