Google Analytics for Laravel 4
Failed to load latest commit information.
src Improve the service provider Oct 3, 2014
tests Initial commit Jun 20, 2013
.gitattributes Initial commit Jun 20, 2013
.gitignore Initial commit Jun 20, 2013
.travis.yml Initial commit Jun 20, 2013
LICENSE Typo fix Jun 3, 2014
composer.json Revert back google/apiclient Dec 8, 2014
phpunit.xml Initial commit Jun 20, 2013


Port of Laravel 3 bundle lordcoste/analytics-s2s for Laravel 4

Build Status


Add thujohn/analytics to composer.json.

"thujohn/analytics": "dev-master"

Run composer update to pull down the latest version of Analytics.

Now open up app/config/app.php and add the service provider to your providers array.

'providers' => array(

Now add the alias.

'aliases' => array(
    'Analytics' => 'Thujohn\Analytics\AnalyticsFacade',


Run php artisan config:publish thujohn/analytics and modify the config file with your own informations.


Querying the API for visits and pageviews in the last week.

More information about this calling the Google Analytics API can be found here A list of all Google Analytics metrics can be found here

$site_id = Analytics::getSiteIdByUrl(''); // return something like 'ga:11111111'

$stats = Analytics::query($site_id, '7daysAgo', 'yesterday', 'ga:visits,ga:pageviews');