Move piwik code into its own js file for compatability with CSP

This commit is contained in:
Jonny Barnes 2017-03-07 19:50:14 +00:00
parent e4ed9c63b5
commit 7d91f8f0f9
5 changed files with 17 additions and 14 deletions

13
public/assets/js/piwik.js Normal file
View file

@ -0,0 +1,13 @@
// Piwik in its own js file to allow usage with a CSP policy
var _paq = _paq || [];
// tracker methods like "setCustomDimension" should be called before "trackPageView"
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.jmb.lv/";
_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);
})();

Binary file not shown.

Binary file not shown.