<?php
/**
* @author Michele Andreoli <michi.andreoli@gmail.com>
* @name request.php
* @version 0.3 updated 07-04-2011
* @license http://opensource.org/licenses/gpl-license-php GNU Public License
* @package SmartGAPI
*/
/***** BEGIN *****/
/* This code retrieves informations from Google Analytics in background */
/******************************************/
/* E-MAIL */
$email = "<your email>";
/* PASSWORD */
$password = "<your password>";
/******************************************/
$dir = $_POST['dir'];
$id = $_POST['id'];
$starting_date = $_POST['starting_date'];
$ending_date = $_POST['ending_date'];
$timezone = $_POST['timezone'];
include_once $dir;
$ga = new gapi($email, $password);
$ga->requestReportData($id, array('browser','browserVersion'), array('pageviews','visits'), null, null, $starting_date, $ending_date);
/***** END *****/
?>
<table>
<tr class="views">
<td>Pageviews</td>
<td><?php echo $ga->getPageviews() ?></td>
</tr>
<tr class="visits">
<td>Visits</td>
<td><?php echo $ga->getVisits() ?></td>
</tr>
<tr class="footer">
<td><a href="http://www.google.com/analytics/">by Google Analytics</a></td>
<td></td>
</tr>
</table>
|