@baris @julian That didn't help. My code snippet was just a piece of the javascript. Here is all of it, maybe that will help figuring out why the $(window)... bit no longer works since upgrading from 1.4.5
var _paq = _paq || [];
(function () {
var u = "//your.piwikurlhere.com/";
function firePiwik (data) {
if (app.user && app.user.uid > 0) {
_paq.push(['setUserId', app.user.uid.toString()]);
_paq.push(['setCustomVariable', 1, "appUserUsername", app.user.username, "visit"]);
}
_paq.push(['setDocumentTitle', document.title]);
_paq.push(['setCustomUrl', location.href]);
_paq.push(['enableHeartBeatTimer']);
_paq.push(['appendToTrackingUrl', 'bots=1']);
if (data.tpl === 'search') {
_paq.push(['trackSiteSearch', ajaxify.data.search_query,, ajaxify.data.matchCount]);
} else {
_paq.push(['trackPageView']);
}
_paq.push(['enableLinkTracking']);
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
}
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
$(window).on('action:ajaxify.end', function(ev, data) {
firePiwik(data);
});
})();
The problem is that pesky $(window)
area. I tried to replace it with the suggestion you made but that also didn't work and spewed number of other console errors.
I think you could just drop this whole code bit into your Custom Javascript area and see it in action. The URL won't be correct but that shouldn't matter.
I really want to get this working so I can stay current with my NodeBB versions. I really do. 
Thanks!