2018-10-22 22:20:33 -04:00
|
|
|
<script type="text/discourse-plugin" version="0.2">
|
|
|
|
api.onPageChange((url, title) => {
|
2018-10-23 09:48:29 -04:00
|
|
|
window._paq = window._paq || [];
|
|
|
|
window._paq_loaded = window._paq_loaded || false;
|
|
|
|
|
|
|
|
if (!_paq_loaded) {
|
|
|
|
var u = `//${settings.host_url}/`;
|
|
|
|
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
|
|
|
_paq.push(['setSiteId', settings.website_id]);
|
|
|
|
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);
|
|
|
|
_paq_loaded = true;
|
2018-10-22 22:20:33 -04:00
|
|
|
}
|
2018-10-23 09:48:29 -04:00
|
|
|
|
|
|
|
const currentUser = api._currentUser;
|
|
|
|
_paq.push(['setCustomVariable', 1, 'Anonymous', !currentUser, 'visit']);
|
|
|
|
_paq.push(["setCustomUrl", url]);
|
|
|
|
_paq.push(["setDocumentTitle", title]);
|
|
|
|
_paq.push(["trackPageView"]);
|
|
|
|
_paq.push(['enableLinkTracking']);
|
2018-10-22 22:20:33 -04:00
|
|
|
});
|
|
|
|
</script>
|