_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