2017 © Pedro Peláez
 

library google-analytics

Google analytics PHP SDK

image

betacie/google-analytics

Google analytics PHP SDK

  • Tuesday, August 4, 2015
  • by yoye
  • Repository
  • 5 Watchers
  • 1 Stars
  • 4,743 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

google-analytics

Tracking events and ecommerce with google analytics, (*1)

<?php

use Betacie\Google\Tracker\EventTracker;
use Betacie\Google\Storage\ArrayStorage;

$storage = new ArrayStorage();
$tracker = new EventTracker($storage);

// You can track many event thanks to Storage classes, you can choose ArrayStorage or SessionStorage
// SessionStorage will be persistant until you render your tracking code.
$tracker->trackEvent([
    'category' => 'Registration',
    'action' => 'Confirmed',
    'label' => 'user-1',
]);

$tracker->trackEvent([
    'category' => 'Registration',
    'action' => 'Completed',
    'label' => 'user-1',
]);

// render() will print the tracking code and clear all event already store, this prevent duplicate tracking
echo $tracker->render();

Usage with Symfony

You could defined Storage and Tracker as Symfony service and inject them in other services., (*2)


<service id="google.event_tracker" class="Betacie\Google\Tracker\EventTracker">
    <argument type="service" id="betacie_google.storage" />
</service>


<service id="google.tracking_bag" class="Betacie\Google\Session\TrackingBag" />


<service id="google.session_storage" class="Betacie\Google\Storage\SessionStorage">
    <argument type="service" id="session" />
    <argument type="service" id="betacie_google.tracking_bag" />
</service>

The Versions

04/08 2015

1.0.x-dev

1.0.9999999.9999999-dev

Google analytics PHP SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

29/05 2015

dev-master

9999999-dev

Google analytics PHP SDK

  Sources   Download

MIT

The Requires

 

20/01 2015

v0.1

0.1.0.0

Google analytics PHP SDK

  Sources   Download

MIT

The Requires