Skip to content
Derek Jones edited this page Jul 5, 2012 · 10 revisions

WB_analytics is a PHP library which will help you fetch analytics reports from your Google account. Google announced an API some months ago but nothing happened ever since so we created this class which will be updated if the API will be published.

WB_analytics was build for one of our modules for Webber. You can view more informations here here.

This data source uses web scraping. This means that Google could easily break it by making changes to the infrastructure of Google Analytics.

It is based on Felix's class which does the same think but for CakePHP.

Usage

[pre]$analytics = new wb_analytics; $analytics->config [ 'user' ] = 'analytics username'; $analytics->config [ 'password' ] = 'analytics password';

$report = array ( 'profile' => 11040536, 'from' => '2009-01-22', 'to' => '2009-02-22', 'report' => 'Dashboard' );

echo $analytics->report ( $report );// output is XML[/pre]

In the above example we're fetching the dashboard. There are other report types such as Visits, UniqueVisitors, Resolutions, content.TopContent, Keywords, ReferringSources, TrafficSources, Speeds and many others.

File:wb_analytics1.zip

Category:Library Category:Library::Analytics Category:Library::Charts

Clone this wiki locally