How To: Piwik and NodeBB
-
@julian We are on 1.6.0 and not Develop.
Our code is almost a carbon copy of the one above in the first post.
<!-- Piwik --> <script type="text/javascript"> var _paq = _paq || []; (function () { var u = "https://our.piwik.com/"; function firePiwik (data) { if (app && 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+'stats/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+'stats/piwik.js'; s.parentNode.insertBefore(g,s); $(window).on('action:ajaxify.contentLoaded', function(ev, data) { firePiwik(data); }); })(); </script> <noscript><p><img src="https://our.piwik.com/stats/piwik.php?idsite=1&rec=1&bots=1" style="border:0;" alt="" /></p></noscript> <!-- End Piwik Code -->
-
@julian Resurrecting an old thread, it is still relevant though.
Since upgrading NodeBB from
v1.4.5
tov1.12.1
my Piwik analytics code no longer works. It looks like @hmj had this same problem when he upgraded tov.1.6.0
.Does anyone have suggestions on what may have changed such that this doesn't seem to work any longer?
$(window).on('action:ajaxify.contentLoaded', function(ev, data) { firePiwik(data); });
Thank you.
Copyright © 2024 NodeBB | Contributors