wikichua / ga
Installs: 48
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/wikichua/ga
Requires
- php: >=5.4.0
- google/apiclient: 1.0.*@dev
- illuminate/support: 4.2.*
This package is auto-updated.
Last update: 2025-10-24 16:56:09 UTC
README
Setup
- Add
wikichua/gatocomposer.json.
# composer require google/apiclient 1.0.*@dev wikichua/ga dev-master
- Add
'Wikichua\Ga\GaServiceProvider',toapp/config/app.phpunder providers array. - Add
'Ga' => 'Wikichua\Ga\Facades\Ga'toapp/config/app.phpunder 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