Skip to content
World Wide Web Server edited this page Jul 4, 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.

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 [url=http://debuggable.com/posts/new-google-analytics-api:480f4dd6-c59c-445f-8ce0-4202cbdd56cb]Felix[/url]'s class which does the same think but for CakePHP.

[h3]Usage[/h3]

[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 [b]Visits, UniqueVisitors, Resolutions, content.TopContent, Keywords, ReferringSources, TrafficSources, Speeds[/b] and many others.

File:wb_analytics1.zip

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

Clone this wiki locally