There is no license information available for the latest version (dev-master) of this package.

dev-master 2014-10-29 06:25 UTC

This package is auto-updated.

Last update: 2024-04-24 13:26:51 UTC


README

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