From: Robert Kaiser Date: Thu, 15 Dec 2016 23:28:16 +0000 (+0100) Subject: make the piwik code work with IE at least down to 8 X-Git-Url: https://git-public.kairo.at/?a=commitdiff_plain;h=5efbb788afd46c103ad629269f3419ab98d4cd48;p=authserver.git make the piwik code work with IE at least down to 8 --- diff --git a/app/piwik.js b/app/piwik.js index 4896dc4..86a1c35 100644 --- a/app/piwik.js +++ b/app/piwik.js @@ -4,10 +4,10 @@ _paq.push(['enableLinkTracking']); (function() { var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - // dataset does not work with IE10 or lower :( - var u=s.parentNode.dataset.piwikurl; + // dataset does not work with IE10 or lower, so work around it with .getAttribute() :( + var u=(s.parentNode.dataset?s.parentNode.dataset.piwikurl:s.parentNode.getAttribute('data-piwikurl')); _paq.push(['setTrackerUrl', u+'piwik.php']); - _paq.push(['setSiteId', s.parentNode.dataset.piwiksite]); + _paq.push(['setSiteId', (s.parentNode.dataset?s.parentNode.dataset.piwiksite:s.parentNode.getAttribute('data-piwiksite'))]); g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); // End Piwik code