diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2016-09-29 23:43:53 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-09-29 23:43:53 +0300 |
commit | 5427698eef049f93dd13ab230641b109cb418e80 (patch) | |
tree | 02a1aa31d807dcc2df3c8906a482bd91ab876c02 /plugins | |
parent | c58f86f21e49934d75cc6f6ec92fe03ace3b25d4 (diff) |
Make sure to load Piwik JS tracker synchronously when requested to be loaded sync (#10557)
* make sure to properly load the tracker sync when requested
* added tests and fixed some
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Morpheus/templates/javascriptCode.twig (renamed from plugins/Morpheus/templates/javascriptCode.tpl) | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/Morpheus/templates/javascriptCode.tpl b/plugins/Morpheus/templates/javascriptCode.twig index 1a9ea321c1..c18d850d34 100644 --- a/plugins/Morpheus/templates/javascriptCode.tpl +++ b/plugins/Morpheus/templates/javascriptCode.twig @@ -7,9 +7,12 @@ {$setTrackerUrl} {$optionsBeforeTrackerUrl}_paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', '{$idSite}']); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async={$loadAsync}; g.defer={$loadAsync}; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); + {% if loadAsync %}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);{% endif %} + })(); </script> +{% if not loadAsync %}<script type='text/javascript' src="{$protocol}{$piwikUrl}/piwik.js"> +{% endif %} <noscript><p><img src="{$protocol}{$piwikUrl}/piwik.php?idsite={$idSite}" style="border:0;" alt="" /></p></noscript> <!-- End Piwik Code --> |