PHP code example of joaofigueira / analytics

1. Go to this page and download the library: Download joaofigueira/analytics library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

joaofigueira / analytics example snippets



use Analytics\DataSources\Piwik;
use Analytics\Querys\Browsers as Analytics; //check out the Querys folder, lots of ready to use Querys in there!

$auth = new Piwik($url, $token, $idSite); //engine(Piwik), url, token, idSite

$result = new Analytics($auth); 
$result ->startDate('2014-10-01')
		->endDate('2014-10-15');

$analyticsData 	= $result->fetchData();
$analyticsgraph	= $result->fetchGraph();


use Analytics\Analytics;

class NewExtension extends Analytics
{
  //here you can write your own code to query the API
}