PHPackages                             fideloper/universalanalytics - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fideloper/universalanalytics

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fideloper/universalanalytics
============================

Implement Google's Measurement Protocol for Universal Analytics on the Server Side

2218.4k4[1 issues](https://github.com/fideloper/UniversalAnalytics/issues)PHP

Since Sep 24Pushed 12y ago4 watchersCompare

[ Source](https://github.com/fideloper/UniversalAnalytics)[ Packagist](https://packagist.org/packages/fideloper/universalanalytics)[ RSS](/packages/fideloper-universalanalytics/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Google Universal Analytics - Measurement Protocol
=================================================

[](#google-universal-analytics---measurement-protocol)

Master: [![Build Status](https://camo.githubusercontent.com/bc1d6e565c162227c7af95a4a2ce0ebeb321d8126053efa0e9b8c224fece60b6/68747470733a2f2f7472617669732d63692e6f72672f666964656c6f7065722f556e6976657273616c416e616c79746963732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/fideloper/UniversalAnalytics)

Develop: [![Build Status](https://camo.githubusercontent.com/1046facd7a31981864091d863ed8f973240cc3e666474c744d58d20f02bdcbf1/68747470733a2f2f7472617669732d63692e6f72672f666964656c6f7065722f556e6976657273616c416e616c79746963732e706e673f6272616e63683d646576656c6f70)](https://travis-ci.org/fideloper/UniversalAnalytics)

---

This implements Google's [Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/). This protocol is a REST api which you can use to send data from your client or server side.

This is a server-side implementation, which you might want to use to send analytics to Google that's related to your application - server metrics, exception tracking, etc.

Google developer docs can be found [here](https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide).

Install
-------

[](#install)

This is available via Packagist. You can install this by adding a dependency in your `composer.json` file.

```
{
    "require": {
        "fideloper/universalanalytics": "dev-master"
    },
}
```

Then run:

```
$ composer install  # or composer update

```

**Note:** Composer will now [install the dev dependencies by default](http://seld.be/notes/composer-installing-require-dev-by-default). For this project, those are [phpunit](https://github.com/sebastianbergmann/phpunit/) and [mockery](https://github.com/padraic/mockery).

Basic Usage
-----------

[](#basic-usage)

Here is some basic usage:

```
