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 Tracker work when initialized after piwik was loaded or when using multiple trackers without _paq #10951

Open
tsteur opened this issue Dec 3, 2016 · 0 comments
Labels
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

In #10878 (comment) we also discuss about how to be using Piwik JavaScript Tracker when piwik.js is loaded first and only initialized later. Eg we could initialize Piwik like this:

_paq.push(['addTracker', [
  ['enableLinkTracking'],
  ['setSiteId', '5'], 
  ['setTrackerUrl', u+'piwik.php'],
  ['trackPageView']
]]);

Ideally, it would have always looked like this as this is clear. We actually define to add a tracker and configure it. If no addTracker is called, no tracker gets added and no methods executed. This would have so many advantages and I cannot think of any downside. If idSite and trackerUrl is not configured, we would pretty much ignore these requests because we know there is no tracker configured instead of current behaviour where we would send the requests to the current website URL which doesn't work.

When receiving an array of configurations we would be able to sort the methods before executing them and it wouldn't matter whether Piwik is already loaded or not. I think this version is even more readable etc and best: I think we could implement it in a way to keep BC although not 100% sure as it is a bit tricky to not ending up with 2 trackers in this case.

Any thoughts on this?

Current implementation is super buggy and does eg not when calling _paq after Piwik was loaded eg addTracker wouldn't work correctly, custom tracker plugins wouldn't work correctly, cookies wouldn't work correctly and more

@mattab mattab added this to the Backlog (Help wanted) milestone Feb 20, 2017
@mattab mattab added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants