webfactory / piwik-bundle

Symfony Bundle with twig-function for the Matomo (fka Piwik) tracking code
MIT License
39 stars 16 forks source link

Link with piwik/piwik-php-tracker #7

Open kachkaev opened 8 years ago

kachkaev commented 8 years ago

In some web apps it may be useful to supplement the javascript tracker with a PHP one. This will help ensure that the statistics are not partially missing because of JS errors in old browsers or very slow networks.

Official implementation of the PHP tracker is in piwik/piwik-php-tracker. It can be easily made available as a service in your bundle. Usage example:

$tracker = $container->get('webfactory_piwik.tracker');
$tracker->doThis();
$tracker->doThat();
$response = new Response();
//...
return $response;

When piwik is disabled in config, the PHP tracker should be too (the service can be replaced with a dummy object having the same API).

ghost commented 8 years ago

:+1:

mpdude commented 5 years ago

Nice idea, I’d be glad to review a PR 🤙🏻