PHPackages                             8ctopus/php-gtag - 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. 8ctopus/php-gtag

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

8ctopus/php-gtag
================

experimental gtag.js implementation in php

0.4.2(5mo ago)3451MITPHPPHP &gt;=8.1CI passing

Since Jul 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/8ctopus/php-gtag)[ Packagist](https://packagist.org/packages/8ctopus/php-gtag)[ Docs](https://github.com/8ctopus/php-gtag)[ RSS](/packages/8ctopus-php-gtag/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (22)Used By (0)

php gtag.js
===========

[](#php-gtagjs)

[![packagist](https://camo.githubusercontent.com/59dde79ea020c1aee72adc4ae836b93b4fe066309ff611f3391387e42a51082c/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f7068702d677461672f76)](https://packagist.org/packages/8ctopus/php-gtag)[![downloads](https://camo.githubusercontent.com/fd0956a7a613237af72a1ff8f44ea94e0e582ee51b9678699e3dfcb7eecd2e67/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f7068702d677461672f646f776e6c6f616473)](https://packagist.org/packages/8ctopus/php-gtag)[![min php version](https://camo.githubusercontent.com/21d171a50dd6618b83a640f73149b256ddc271747425e7def8535eaa172f79f4/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f7068702d677461672f726571756972652f706870)](https://packagist.org/packages/8ctopus/php-gtag)[![license](https://camo.githubusercontent.com/ca41e9c584f0ee74fdd9bb7b39cb61504f91fc52ed3f620308f06fb7e4d6c265/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f7068702d677461672f6c6963656e7365)](https://packagist.org/packages/8ctopus/php-gtag)[![tests](https://github.com/8ctopus/php-gtag/actions/workflows/tests.yml/badge.svg)](https://github.com/8ctopus/php-gtag/actions/workflows/tests.yml)[![code coverage badge](https://raw.githubusercontent.com/8ctopus/php-gtag/image-data/coverage.svg)](https://raw.githubusercontent.com/8ctopus/php-gtag/image-data/coverage.svg)[![lines of code](https://raw.githubusercontent.com/8ctopus/php-gtag/image-data/lines.svg)](https://raw.githubusercontent.com/8ctopus/php-gtag/image-data/lines.svg)

Experimental Google Analytics 4 gtag.js php implementation for server side tracking.

update
------

[](#update)

Google updated its cookies at the start of May 2025. I've added support for the new cookie format and it appears to work. You will need to upgrade to 0.4.x.

why?
----

[](#why)

Google Analytics 4 measurement protocol is limited in what it can measure.

The objective of this library is to use the much more powerful gtag.js API for server side measurements.

I'm using the library for some personal projects (tracking of PayPal sales) and it works, however it's far from a perfect replication of what gtag.js does. Use it at your own risk.

Contributions welcome!

install
-------

[](#install)

```
composer require 8ctopus/php-gtag

```

demo
----

[](#demo)

Check `demo.php` on how to use it.

cookies
-------

[](#cookies)

The cookies Google Analytics uses are described [here](https://github.com/8ctopus/php-gtag/blob/master/cookies.md)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance71

Regular maintenance activity

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~43 days

Recently: every ~187 days

Total

21

Last Release

164d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dafd5f7ef8134a5c9b231686c5da3d6416db09139b45aac0b26952178dffb8a?d=identicon)[8ctopus](/maintainers/8ctopus)

---

Top Contributors

[![8ctopus](https://avatars.githubusercontent.com/u/13252042?v=4)](https://github.com/8ctopus "8ctopus (166 commits)")

---

Tags

google-analytics-4gtaggtag.js

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/8ctopus-php-gtag/health.svg)

```
[![Health](https://phpackages.com/badges/8ctopus-php-gtag/health.svg)](https://phpackages.com/packages/8ctopus-php-gtag)
```

###  Alternatives

[websharks/html-compressor

Combines &amp; compresses CSS/JS/HTML code.

407.1k1](/packages/websharks-html-compressor)[limewell/laravel-make-extender

This package helps to generate and autoload custom helpers, It can generate multilevel helpers in the context of the directory.

366.8k](/packages/limewell-laravel-make-extender)[linkorb/autotune

Tune your autoloader

177.0k17](/packages/linkorb-autotune)[jayanka/patch-manager

A magento extension to maintain data patches

232.4k](/packages/jayanka-patch-manager)[tapp/filament-progress-bar-column

Add beautiful, color-coded progress bars to your Filament table columns. Perfect for inventory, tasks, storage, and any progress metrics without writing custom views.

124.5k](/packages/tapp-filament-progress-bar-column)

PHPackages © 2026

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