Send Google Analytics events from PHP

v1.2.0 2020-10-01 22:19 UTC

This package is auto-updated.

Last update: 2024-05-29 03:10:37 UTC


Create a Google Analytics Event from PHP

This is a small class to post Analytics events from PHP. This is useful for logging and event tracking.


composer require there4/php-analytics-event



use There4\Analytics\AnalyticsEvent;

// Record the download event in Analytics
$events = new AnalyticsEvent('UAxxxxxxx', '');
$events->trackEvent('resources', 'download', 'cli-latest');

Related Projects

The Google Analytics Measurement Protocol library for PHP project is a much larger implementation of the Measurement Protocol. If you need more than a simple tracking event you should check it out.