PHPackages                             clippings/php-gacx - 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. clippings/php-gacx

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

clippings/php-gacx
==================

Server-side GA Content Experiments

1.1.0(10y ago)037.7kLGPL-3.0+PHP

Since Jan 6Pushed 10y agoCompare

[ Source](https://github.com/clippings/php-gacx)[ Packagist](https://packagist.org/packages/clippings/php-gacx)[ Docs](https://github.com/thomasbachem/php-gacx)[ RSS](/packages/clippings-php-gacx/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Server-Side GA Content Experiments
==================================

[](#server-side-ga-content-experiments)

While this is a standalone library, you might also be interested in the companion project for general server-side Google Analytics tracking: [php-ga](https://github.com/thomasbachem/php-ga).

About
-----

[](#about)

php-gacx is basically Google's [cx/api.js](https://developers.google.com/analytics/devguides/collection/gajs/experiments#cxjs)in PHP: A server-side implementation that allows you to control and implement [Content Experiments](https://developers.google.com/analytics/devguides/platform/features/experiments-overview)entirely on the server.

This is done by parsing experiment data to make use of GA's multi-armed bandit algorithm as well as programmatically modifying the "\_\_utmx" and "\_\_utmxx" cookies.

This does however depend on Google Analytics being used in the browser, see "Usage" below.

This library might become obsolete as soon as Google implements Content Experiments into their [Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/).

Requirements
------------

[](#requirements)

Requires PHP 5.3+ as namespaces and closures are used. Has no other dependencies and can be used independantly from any framework or whatsoever environment.

Usage Example
-------------

[](#usage-example)

All methods match the ones from the JS API, so using php-gacx is pretty straightforward if you've experience with [cx/api.js](https://developers.google.com/analytics/devguides/collection/gajs/experiments#cxjs):

```
use UnitedPrototype\GoogleAnalytics;

$experiment = new GoogleAnalytics\Experiment('reBreiK2QpOws-pJlkla1o');

$variation = $experiment->chooseVariation();
```

In order to have the experiment data transferred to Google Analytics, you need to use Google Analytics on the client side either via the traditional `ga.js` or Google's new `analytics.js` (Universal Analytics).

`ga.js` will work out of the box, as it simply consider and include the "\_\_utmx" cookie value when sending tracking data to Google Analytics.

`analytics.js` does sadly no longer consider the "\_\_utmx" cookie. You will therefore have to tell it via Javascript which variation of an experiment has been chosen, and it's limited to one experiment per page. Example:

```
// Hand over experiment data to analytics.js, as it ignores the "__utmx" cookie
window.gaData = {
	expId:  '',
	expVar: ''
};
```

The advantage of using php-gacx here is still that you can choose the variation on the server-side while still making use of the multi-armed bandit algorithm considering the variation's different weights.

Disclaimer
----------

[](#disclaimer)

Google Analytics is a registered trademark of Google Inc.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~0 days

Total

2

Last Release

3828d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/506129?v=4)[Harry Dobrev](/maintainers/hkdobrev)[@hkdobrev](https://github.com/hkdobrev)

![](https://avatars.githubusercontent.com/u/4113307?v=4)[Danail Kyosev](/maintainers/dkyosev)[@dkyosev](https://github.com/dkyosev)

![](https://avatars.githubusercontent.com/u/7592650?v=4)[Evstati Zarkov](/maintainers/EZarkov)[@EZarkov](https://github.com/EZarkov)

![](https://avatars.githubusercontent.com/u/745771?v=4)[Filip Georgiev](/maintainers/phgeorgiev)[@phgeorgiev](https://github.com/phgeorgiev)

![](https://avatars.githubusercontent.com/u/490439?v=4)[Zdravko Evstatiev](/maintainers/zedevs)[@zedevs](https://github.com/zedevs)

---

Top Contributors

[![thomasbachem](https://avatars.githubusercontent.com/u/231538?v=4)](https://github.com/thomasbachem "thomasbachem (4 commits)")[![dkyosev](https://avatars.githubusercontent.com/u/4113307?v=4)](https://github.com/dkyosev "dkyosev (1 commits)")

### Embed Badge

![Health badge](/badges/clippings-php-gacx/health.svg)

```
[![Health](https://phpackages.com/badges/clippings-php-gacx/health.svg)](https://phpackages.com/packages/clippings-php-gacx)
```

PHPackages © 2026

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