Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tracking with multiple trackers more consistent and robust #10952

Open
tsteur opened this issue Dec 3, 2016 · 1 comment
Open

Make tracking with multiple trackers more consistent and robust #10952

tsteur opened this issue Dec 3, 2016 · 1 comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@tsteur
Copy link
Member

tsteur commented Dec 3, 2016

By default tracking is done like this: _paq.push(['trackFooBar', 'param1', 'param2]).

When working with multiple trackers (and tracking different data to different sites) the same would be

var tracker = Piwik.getAsyncTracker(piwikUrl, siteId);
tracker.trackFooBar('param1', 'param2');

I think it would be more consistent to always use a push method as well instead:

var tracker = Piwik.getAsyncTracker(piwikUrl, siteId);
tracker.push(['trackFooBar', 'param1', 'param2']);

This simplifies some docs greatly, for example http://developer.piwik.org/guides/media-analytics/reference where we always need to explain how and where to call different kind of plugin tracker methods.

It would also make it more robust since tracker.trackFooBar() would result in an error when it is not defined but in the push method we can log or ignore certain methods, etc

It would also work with global tracker plugin methods (the ones that have ::) and works perfectly with custom tracker methods. Even when a plugin is uninstalled tracking would still work because tracker.MediaAnalytics.scanForMedia would not result in an error when done like this: tracker.push(['MediaAnalytics.scanForMedia']).

Easier to port code between _paq.push and multiple trackers. Because syntax is the same it is much easier to move from one solution to another.

@hpvd
Copy link

hpvd commented Dec 19, 2016

+1

@mattab mattab added this to the Backlog (Help wanted) milestone Feb 20, 2017
@mattab mattab added c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. labels Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

3 participants