Search by

xima / xima-typo3-matomo-deferred-tracking

m.schneider

Sends the server-side Matomo tracking requests of pagemachine/matomo-tracking after the response has been delivered

Package info

github.com/xima-media/xima-typo3-matomo-deferred-tracking

Type:typo3-cms-extension

pkg:composer/xima/xima-typo3-matomo-deferred-tracking

Statistics

Installs: 29

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-12-01 16:09 UTC

This package is auto-updated.

Last update: 2026-12-01 16:12:55 UTC


README

TYPO3 extension that sends the server-side Matomo tracking requests of pagemachine/matomo-tracking after the response has been delivered to the visitor.

Why

The tracker sends its request synchronously while the page is being built, using TYPO3's shared HTTP client. When Matomo is slow (restart, network hiccup, load), every tracked page view waits up to $GLOBALS['TYPO3_CONF_VARS']['HTTP']['timeout'].

With this extension:

  • Under PHP-FPM, the tracker gets an immediate 204 and the request is queued. A shutdown function calls fastcgi_finish_request() (the response is delivered and the connection closed) and then sends the queue. Failures are logged as ERROR by Xima.XimaTypo3MatomoDeferredTracking.Http.DeferredHttpClient.
  • Other SAPIs (CLI) send synchronously, as before.
  • Tracking requests use their own short timeout. TYPO3's proxy, TLS and header settings still apply.

Works with pagemachine/typo3-matomo-tracking and with own integrations of pagemachine/matomo-tracking: a compiler pass replaces the HTTP client of Pagemachine\MatomoTracking\Tracking\ActionTracker, whatever defines it.

Installation

composer require xima/xima-typo3-matomo-deferred-tracking

Nothing else to configure. Remove an own $httpClient argument of the ActionTracker in your site package; the extension replaces it anyway.

Configuration

Extension settings (Admin Tools > Settings > Extension Configuration):

Setting Default
timeout 1 Total timeout of a tracking request in seconds
connectTimeout 0.5 Timeout for the connection in seconds

A hanging Matomo still keeps the PHP-FPM worker busy until the timeout, but only after the response has been delivered.

Upstream

Proposed as an option of the extension itself: pagemachine/typo3-matomo-tracking#44. Once that exists, this extension can be removed.

Development

composer install
composer ci   # php-cs-fixer, PHPStan, PHPUnit

License

GPL-2.0-or-later