wikichua / ga
There is no license information available for the latest version (dev-master) of this package.
dev-master
2014-10-29 06:25 UTC
Requires
- php: >=5.4.0
- google/apiclient: 1.0.*@dev
- illuminate/support: 4.2.*
This package is auto-updated.
Last update: 2024-11-24 15:05:09 UTC
README
Setup
- Add
wikichua/ga
tocomposer.json
.
# composer require google/apiclient 1.0.*@dev wikichua/ga dev-master
- Add
'Wikichua\Ga\GaServiceProvider',
toapp/config/app.php
under providers array. - Add
'Ga' => 'Wikichua\Ga\Facades\Ga'
toapp/config/app.php
under aliases array. - Publish configuration.
# php artisan config:publish wikichua/ga
- Create your CLIENT ID, EMAIL ADDRESS and download PUBLIC KEY FINGERPRINTS (P12 key) from Google Developer Console
- Fill up
app/config/wikichua/config/ga.php
Usage
- Retrieve rows data in array.
$Ga = Ga::make('74924308')
->from('360daysAgo')
->to('today')
->metrics('sessions')
->metrics('entrances')
->dimensions('country')
->dimensions('region')
->filters('country==Malaysia')
->filters('country==Canada')
->get();
echo '<pre>';
print_r($Ga);
echo '</pre>';
$Ga = Ga::make('74924308')
->range('2014-01-01','yesterday')
->metrics('sessions','entrances')
->dimensions('country','region')
->filters('country==Malaysia','country==Canada')
->get();
echo '<pre>';
print_r($Ga);
echo '</pre>';
- Retrive all in Object
$Ga = Ga::make('74924308')
->range('2014-01-01','yesterday')
->metrics('sessions','entrances')
->dimensions('country','region')
->filters('country==Malaysia','country==Canada')
->all();
echo '<pre>';
print_r($Ga);
echo '</pre>';
Tips
Explore this Google Analytics Query Explorer 2