I want to replace inside VirtualHost </body>
element with:
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//stats.mydomain.com/";
_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);
})();
</script>
<noscript><p><img src="//stats.mydomain.com/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code --></body>
I need to do this inside VirtualHost section because I can't directly modify website code.
I was thinking about some apache modules like mod_substitute, mod_sed, mod_include.
I need to add this PIWIK statistics code into every page.
Is this good way? Which one of this mods will be best to do this? Or maybe there is another solution?