Quantcast
Viewing all articles
Browse latest Browse all 13117

Re: requirejs feature makes trouble when piwik is on different host

OK, think I got it... I rewrote my snippet to be

<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [],
	u=(("https:" == document.location.protocol) ? "https" : "http") + "://stats.acme.com//";
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
require(['piwik']);
</script>
<noscript><p><img src="//stats.acme.com/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Code -->

...and added to the requirejs configuration
paths: {
	'piwik': '//stats.acme.com/piwik'

now the require() call in my snippet fetches stats.acme.com/piwik.js and is satisfied because it's defined() inside that script.

Viewing all articles
Browse latest Browse all 13117

Trending Articles