webfactory / piwik-bundle

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

Add support for additional tracker API calls #2

Closed mpdude closed 10 years ago

mpdude commented 10 years ago

There are quite a few things and settings you can apply to the tracker; see http://developer.piwik.org/api-reference/tracking-javascript.

Of particular interest are user-defined variables. For example, you could push the category of the currently displayed blog post to Piwik to get categories-based analytics.

All those options basically end up as values/arrays in the _paq JavaScript variable.

Now it would be very handy if there was a service so you could write in your controller

$this->get('piwik.tracker')->push(['trackGoal', 1, $cart->getValue()]);

or in Twig

{{ piwik_push(['setCustomVariable', 1, "gender", "male", "visit"]) }}

Then the bundle could collect all those extra settings and write them out once it renders the piwik_code.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling e83295258d81c94ea6ccef5a197f56f0b9fe2cc5 on fix-issue-2 into ffd439037614070cd4c6ae2ed7ae11178841abc6 on master.