2017 © Pedro Peláez
 

library ga

image

wikichua/ga

  • Wednesday, October 29, 2014
  • by wikichua
  • Repository
  • 2 Watchers
  • 1 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ga (Google Analytic) for Laravel 4

Setup

  1. Add wikichua/ga to composer.json.
# composer require google/apiclient 1.0.*@dev wikichua/ga dev-master
  1. Add 'Wikichua\Ga\GaServiceProvider', to app/config/app.php under providers array.
  2. Add 'Ga' => 'Wikichua\Ga\Facades\Ga' to app/config/app.php under aliases array.
  3. Publish configuration.
# php artisan config:publish wikichua/ga
  1. Create your CLIENT ID, EMAIL ADDRESS and download PUBLIC KEY FINGERPRINTS (P12 key) from Google Developer Console
  2. Fill up app/config/wikichua/config/ga.php

Usage

  1. 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>';


1. 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, (*1)

The Versions

29/10 2014

dev-master

9999999-dev

  Sources   Download

The Requires

 

by Wiki Chua