2017 © Pedro Peláez
 

library laravel-gamp

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

image

irazasyed/laravel-gamp

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  • Wednesday, October 18, 2017
  • by irazasyed
  • Repository
  • 16 Watchers
  • 204 Stars
  • 124,393 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 14 Forks
  • 1 Open issues
  • 12 Versions
  • 13 % Grown

The README.md

Laravel-GAMP Package

[![Join PHP Chat][ico-phpchat]][link-phpchat] Chat on Telegram Laravel & Lumen Package ![Latest Version on Packagist][ico-version] Software License ![Total Downloads][ico-downloads], (*1)

Laravel GAMP: Google Analytics Measurement Protocol Package for Laravel & Lumen., (*2)

Send data to Google Analytics from Laravel/Lumen. Supports all GA Measurement Protocol API methods., (*3)

Laravel GAMP, (*4)

Quick start

Install

Step 1: Install Through Composer

$ composer require irazasyed/laravel-gamp

(Lumen) Add the Service Provider

Open bootstrap/app.php and register the service provider by adding:, (*5)

$app->register(Irazasyed\LaravelGAMP\LaravelGAMPServiceProvider::class);

Step 2: Publish Config

Open your terminal window and fire the following command to publish config file to your config directory:, (*6)

``` bash $ php artisan vendor:publish --provider="Irazasyed\LaravelGAMP\LaravelGAMPServiceProvider", (*7)


## Usage Open config file `config/gamp.php` and set the `tracking_id` with your Google Analytics tracking / web property ID. Refer the config file for other default configuration settings. This Package adds Laravel Support to [GA Measurement Protocol][link-lib] PHP Library by THE ICONIC. It's simply a wrapper around the library with default config for easier usage with Laravel. So all the methods listed [here][link-docs] are available and will work seamlessly. ### Example Usage Send a Page view hit: ``` php use Irazasyed\LaravelGAMP\Facades\GAMP; $gamp = GAMP::setClientId( '123456' ); $gamp->setDocumentPath( '/page' ); $gamp->sendPageview();

Send an Event:, (*8)

``` php use Irazasyed\LaravelGAMP\Facades\GAMP;, (*9)

$gamp = GAMP::setClientId( '123456' ); $gamp->setEventCategory('Blog Post') ->setEventAction('Create') ->setEventLabel('Using GAMP In Laravel') ->sendEvent();, (*10)


### Config Overview Open the config file for detailed comments for each option. Set your Google Analytics Tracking / Web Property ID in `tracking_id` key **[REQUIRED]** ``` php 'tracking_id' => 'UA-XXXX-Y',

All other configuration options are optional, use as per your requirements., (*11)

To send data over SSL, set is_ssl to true., (*12)

``` php 'is_ssl' => true,, (*13)


To disable library in Staging/Dev env (Prevents the library from sending any hits to GA), set `is_disabled` to true. ``` php 'is_disabled' => true,

To Anonymize IP, set anonymize_ip to true., (*14)

``` php 'anonymize_ip' => true,, (*15)


To Make Async Requests, set `async_requests` to true. ``` php 'async_requests' => true,

..., (*16)

Refer the library's documentation for other remaining methods and examples, they all work., (*17)

Note: You don't have to use the protocol version, tracking id, anonymize ip and async request (non-blocking) methods from the original library as they're automatically set in Service Provider when the package is initialized based on the config file. As long as you update the config file with correct settings, it should work just fine., (*18)

Additional information

Any issues, please report here, (*19)

Credits

License

The MIT License (MIT). Please see License File for more information., (*20)

The Versions

18/10 2017

dev-master

9999999-dev

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol lumen google analytics

18/10 2017

v1.3.0

1.3.0.0

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol lumen google analytics

18/10 2017

dev-analysis-q12NZL

dev-analysis-q12NZL

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol lumen google analytics

10/04 2017

v1.2.0

1.2.0.0

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol lumen google analytics

27/01 2017

0.5.x-dev

0.5.9999999.9999999-dev

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol

11/01 2016

v1.1.0

1.1.0.0

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol lumen google analytics

03/07 2015

v1.0.0

1.0.0.0

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol

03/07 2015

v0.5.0

0.5.0.0

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol

16/04 2015

v0.4.0

0.4.0.0

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

  Sources   Download

MIT

The Requires

 

by Syed Irfaq Raza

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol

10/04 2015

v0.3.0

0.3.0.0

Laravel Wrapper for The Iconic's GA Measurement Protocol Library

  Sources   Download

MIT

The Requires

 

by Syed Irfaq Raza

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol

12/03 2015

v0.2.0

0.2.0.0

Laravel Wrapper for The Iconic's GA Measurement Protocol Library

  Sources   Download

MIT

The Requires

 

by Syed Irfaq Raza

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol

27/02 2015

v0.1.0

0.1.0.0

Laravel Wrapper for The Iconic's GA Measurement Protocol Library

  Sources   Download

MIT

The Requires

 

by Syed Irfaq Raza

analytics tracking google analytics measurement protocol laravel google analytics ga measurement protocol