I want to write/set the SCRIPT tag (that is generated) in the Piwik Tracking code myself on a page. Where should I put it? Does it matter? I have very little Java Script knowledge.
This is a typical Tracking code:
This is the part I want to 'write' myself:
In my documents right now, I have it like this:
Should I be putting the script tag BEFORE or AFTER the script block below?
Thank you for any help.
This is a typical Tracking code:
<!-- Piwik --> <script type="text/javascript"> var _paq = _paq || []; (function(){ var u=(("https:" == document.location.protocol) ? "https://{$PIWIK_URL}/" : "http://{$PIWIK_URL}/"); _paq.push(['setSiteId', {$IDSITE}]); _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Piwik Code -->
This is the part I want to 'write' myself:
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
In my documents right now, I have it like this:
<!-- SCRIPT TAG PUT HERE BY ME --> <script defer async src="http:/{$PIWIK_URL}/piwik.js"></script> <!-- Piwik --> <script type="text/javascript"> var _paq = _paq || []; (function(){ var u=(("https:" == document.location.protocol) ? "https://{$PIWIK_URL}/" : "http://{$PIWIK_URL}/"); _paq.push(['setSiteId', {$IDSITE}]); _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); })(); </script> <!-- End Piwik Code -->
Should I be putting the script tag BEFORE or AFTER the script block below?
Thank you for any help.