Login   Register  
PHP Classes

File: utils/request.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michele Andreoli  >  SmartGAPI  >  utils/request.php  >  Download  
File: utils/request.php
Role: Example script
Content type: text/plain
Description: script for the ajax request
Class: SmartGAPI
Display site statistics from Google Analytics
Author: By
Last change: Security bug fixed
Date: 3 years ago
Size: 1,361 bytes


Class file image Download
 * @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'];

$ga = new gapi($email$password);
$ga->requestReportData($id, array('browser','browserVersion'), array('pageviews','visits'), nullnull$starting_date$ending_date);
/***** END *****/
    <tr class="views">
        <td><?php echo $ga->getPageviews() ?></td>
    <tr class="visits">
        <td><?php echo $ga->getVisits() ?></td>
    <tr class="footer">
        <td><a href="http://www.google.com/analytics/">by Google Analytics</a></td>