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: 9 years ago
Size: 2,228 bytes
 

Contents

Class file image Download
<?php
/**
 * @author Michele Andreoli <michi.andreoli[at]gmail.com>
 * @name index.php
 * @version 0.3 updated 07-04-2011
 * @license http://opensource.org/licenses/gpl-license-php GNU Public License
 * @package SmartGAPI
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <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>
    </head>
    <style>
        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;
            border-collapse:collapse;
            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 {
            padding:5px;
        }
    </style>
    <body>
        <p style="text-align:center;color:#f00">Testing SmartGAPI</p>
        <?php
           
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
           
$stat->setDiv_id("mydiv");

           
//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
           
$stat->showGapiBox('fade');
       
?>
</body>
</html>