PHPackages                             krizon/php-ga-measurement-protocol - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. krizon/php-ga-measurement-protocol

ActiveLibrary

krizon/php-ga-measurement-protocol
==================================

Easy use of the Google Analytics Measurement Protocol in PHP

v1.0.0(10y ago)109566.1k↑11%23[6 issues](https://github.com/krizon/php-ga-measurement-protocol/issues)[3 PRs](https://github.com/krizon/php-ga-measurement-protocol/pulls)5MITPHP

Since Apr 8Pushed 9y ago8 watchersCompare

[ Source](https://github.com/krizon/php-ga-measurement-protocol)[ Packagist](https://packagist.org/packages/krizon/php-ga-measurement-protocol)[ RSS](/packages/krizon-php-ga-measurement-protocol/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (5)

Google Analytics Measurement Protocol PHP Client
================================================

[](#google-analytics-measurement-protocol-php-client)

[![Build Status](https://camo.githubusercontent.com/10ab73205dfbe1572790d49e1899cf982094f405198cfa3106bc14f2b8cf7a0c/68747470733a2f2f7472617669732d63692e6f72672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/krizon/php-ga-measurement-protocol)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/31b57d19752a874b81697887abbaa9c874ed1334aca7bad61878bd309c422574/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2f6261646765732f7175616c6974792d73636f72652e706e673f733d36393062613334363564363239663938373636373861663961653461343161333436633939346162)](https://scrutinizer-ci.com/g/krizon/php-ga-measurement-protocol/)[![Code Coverage](https://camo.githubusercontent.com/cb02c2d4031a110ee7b2f69fb86bc11329287f033bf0701f0a07578a11ccfc88/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2f6261646765732f636f7665726167652e706e673f733d31376663316239396663383566656333323933323962393665636361313833386665336135623764)](https://scrutinizer-ci.com/g/krizon/php-ga-measurement-protocol/)[![Latest Stable Version](https://camo.githubusercontent.com/174bef5e2e4b155dab3cc83d755e17a57cbfe54992a3e4c162939ed85d8e7e78/68747470733a2f2f706f7365722e707567782e6f72672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2f762f737461626c652e706e67)](https://packagist.org/packages/krizon/php-ga-measurement-protocol) [![Total Downloads](https://camo.githubusercontent.com/4e317b1a5ea8d6ba88dba6e5e66d909b3731923b222044e919fdee405e67bc7d/68747470733a2f2f706f7365722e707567782e6f72672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/krizon/php-ga-measurement-protocol) [![Latest Unstable Version](https://camo.githubusercontent.com/34f5a8d8fa41ec1f3e4d78ccb8590d4e294c23eaa92de69b041fbab0263e47af/68747470733a2f2f706f7365722e707567782e6f72672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2f762f756e737461626c652e706e67)](https://packagist.org/packages/krizon/php-ga-measurement-protocol) [![License](https://camo.githubusercontent.com/6659d397b57f35efe97275eb26f27a50ad3d533ad0e0526764c44b1eb2234a15/68747470733a2f2f706f7365722e707567782e6f72672f6b72697a6f6e2f7068702d67612d6d6561737572656d656e742d70726f746f636f6c2f6c6963656e73652e706e67)](https://packagist.org/packages/krizon/php-ga-measurement-protocol)

A full featured php client for the Google Analytics Measurment Protocol API. Build upon the shoulders of the great [Guzzle](http://docs.guzzlephp.org/en/latest/).

See

Installation
------------

[](#installation)

Use [Composer](http://getcomposer.org/doc/00-intro.md) to add this library to your dependencies:

```
$ composer require krizon/php-ga-measurement-protocol
```

Features
--------

[](#features)

- Page tracking
- Event tracking
- Ecommerce tracking
- Social interactions tracking
- Exception tracking
- User timing tracking
- App tracking
- Non-blocking requests (todo)

Usage
-----

[](#usage)

```
$config = array(
    'ssl' => true // Enable/Disable SSL, default false
);
$client = Krizon\Google\Analytics\MeasurementProtocol\MeasurementProtocolClient::factory($config);
$client->pageview(array(
    'tid' => 'UA-XXXX-XXXX', // Tracking Id
    'cid' => 'XXXX-XXXXX-XXXXX', // Customer Id
    'dh' => 'domain.do',
    'dp' => '/php-ga-measurement-protocol/phpunit-test',
    'dt' => 'PHP GA Measurement Protocol'
));
```

Testing
-------

[](#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`

We have two types of tests:

- Tests with mocked 200 OK response, @group `__nogroup__`. This type of tests are used tor testing required fields, asserting classtypes etc.;
- Tests that do real calls to the Google API, @group `internet`. The Google API itself always returns a 200 OK so to be sure the requests are transferred and handled correctly you can run the tests of group 'internet'. Before running this group make sure you've configured the correct tracking id in the phpunit.xml configuration by setting the env variable `tracking_id`. This group is excluded by default but you can run this tests by calling: `$ vendor/bin/phpunit --group internet`

Contributors
------------

[](#contributors)

- [Kristian Zondervan](https://github.com/krizon)
- [Alexandre Assouad](https://github.com/t0k4rt)
- [Matt Weghorst](https://github.com/mattweg)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 75.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~549 days

Total

2

Last Release

3874d ago

Major Versions

0.1.0 → v1.0.02015-10-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/42ee5904cfa308574ecc37759c9c01b9765a211c5a36b30022be7a9eaf18f8e2?d=identicon)[krizon](/maintainers/krizon)

---

Top Contributors

[![krizon](https://avatars.githubusercontent.com/u/880695?v=4)](https://github.com/krizon "krizon (46 commits)")[![moriony](https://avatars.githubusercontent.com/u/1702031?v=4)](https://github.com/moriony "moriony (8 commits)")[![t0k4rt](https://avatars.githubusercontent.com/u/498106?v=4)](https://github.com/t0k4rt "t0k4rt (4 commits)")[![mattweg-zz](https://avatars.githubusercontent.com/u/167712?v=4)](https://github.com/mattweg-zz "mattweg-zz (2 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/krizon-php-ga-measurement-protocol/health.svg)

```
[![Health](https://phpackages.com/badges/krizon-php-ga-measurement-protocol/health.svg)](https://phpackages.com/packages/krizon-php-ga-measurement-protocol)
```

###  Alternatives

[coincheck/coincheck

Bindings of coincheck API

202.2k](/packages/coincheck-coincheck)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
