moriony / ga-measurement-protocol-client

Google Analytics measurement protocol client wrapper based on krizon/php-ga-measurement-protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Analytics Measurement Protocol PHP Client wrapper

Build Status Coverage Status SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

Google Analytics Measurement Protocol PHP client wrapper based on krizon/php-ga-measurement-protocol

See Google Analytics Measurement Protocol documentation

Installation

Use Composer to add this library to your dependencies:

$ php composer.phar require moriony/ga-measurement-protocol-client:dev-master

Usage

use \Moriony\Google\Analytics\MeasurementProtocol\Client;

$client = new Client([
    Client::OPT_TRACKING_ID => 'UA-XXXXXXXXX-Y',
    Client::OPT_SSL => true,
]);

$response = $client->createEvent()
    ->setCustomerId(555)
    ->setCategory('video')
    ->setAction('play')
    ->setLabel('holiday')
    ->setValue(300)
    ->track();

Testing

Before you can run the tests make sure you installed the dependencies using composer:

$ composer install

PHPUnit itself is included in the dependencies so now you can call:

$ vendor/bin/phpunit

About

Google Analytics measurement protocol client wrapper based on krizon/php-ga-measurement-protocol


Languages

Language:PHP 100.0%