moriony / ga-measurement-protocol-client
Google Analytics Measurement Protocol PHP 客户端包装器
0.0.1
2014-09-04 13:31 UTC
Requires
- guzzle/guzzle: ~3.7
- krizon/php-ga-measurement-protocol: 0.1.*
Requires (Dev)
- phpunit/phpunit: >=3.7.28
- satooshi/php-coveralls: 0.6.*
This package is auto-updated.
Last update: 2024-08-25 18:45:17 UTC
README
基于 krizon/php-ga-measurement-protocol 的 Google Analytics Measurement Protocol PHP 客户端包装器
参阅 Google Analytics Measurement Protocol 文档
安装
使用 Composer 将此库添加到您的依赖项中
$ php composer.phar require moriony/ga-measurement-protocol-client:dev-master
用法
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();
测试
在运行测试之前,请确保您已使用 composer 安装了依赖项
$ composer install
PHPUnit 本身包含在依赖项中,因此现在您可以调用
$ vendor/bin/phpunit