PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Michele Andreoli  >  SmartGAPI  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example of use
Class: SmartGAPI
Display site statistics from Google Analytics
Author: By
Last change: update mail
Date: 2 years ago
Size: 2,228 bytes


Class file image Download
 * @author Michele Andreoli <michi.andreoli[at]>
 * @name index.php
 * @version 0.3 updated 07-04-2011
 * @license GNU Public License
 * @package SmartGAPI
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script type="text/javascript" src="js/jquery-1.4.2.js"></script>
        <title>Testing SmartGAPI</title>
        div#mydiv {
            margin-top: 10px;
            font-family: "Lucida Grande", Verdana;
            text-align: center;

        div#mydiv table {
            margin: auto;
            text-align: left;
            font-size: 12px;
            border:2px solid #333;
            color: #555;
            background: #ddd;

        div#mydiv table tr.visits{
            font-weight: bold;

        div#mydiv table tr.footer{
            font-size: 10px;
            font-style: italic;

        div#mydiv table td {
        <p style="text-align:center;color:#f00">Testing SmartGAPI</p>
require_once 'SmartGAPI.class.php';

//Settings for Google Analytics
            //Email and password to set in request.php for security reason
$stat = new SmartGAPI("gapi.class.php", "utils/request.php", '36801245');

//If you want give an id at your div

//Set the starting date of your stats, the ending date if not specify is the current day
            //If you want only the stats of the current month, don't specify this param 'setStarting_date'
$stat->setStarting_date('2011-03-01', 'Europe/Rome');

//Show statistics box in your div