How can I use Piwik.js with minify?

Hello all

I’m desperatly looking for a way to cue the piwik.js into the minified link to call several scripts, eg:

<script src="/min/?b=js&f=css_browser_selector.js,jquery.min.js,jquery.easing.1.3.js,piwik.js"></script>

How can I tell Piwik the script is located there?

The Piwik dashboard doesn’t need to know where piwik.js is, so you’re free to minify/combine it with other scripts if you want to try to improve the page load times on the pages you want to track.

Thanks for you reply Mr vipsoft.
If I insert the piwik js as in the above example and suppress the other call :

<script>
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mysite.com/piwik/" : "http://mysite.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>

it doesn’t work anymore.
Surely I’m missing something. But what? style_emoticons/<#EMO_DIR#>/blink.gif

It depends on the rest of your tracking code. If you remove that snippet, make sure any code that follows doesn’t depend on pkBaseURL being defined.

– Anthon

[quote=vipsoft @ May 25 2010, 04:07 PM]It depends on the rest of your tracking code. If you remove that snippet, make sure any code that follows doesn’t depend on pkBaseURL being defined.

– Anthon[/quote]
Thanks again Anthon but I do need an example since each try disable tracking.
The Piwiks script in my template file is the common one:

<!-- Piwik -->
<script>
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mysite.com/piwik/" : "http://mysite.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script>
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://mysite.com/piwik/piwik.php?idsite=1" style="border:0" alt="outil de statistiques du blog en HTML5"/></p></noscript>
<!-- End Piwik Tag -->

If I remove the 1st script and add the piwik.js in the combined path as above it fails. style_emoticons/<#EMO_DIR#>/mellow.gif

My point is that you can’t simply remove the first block entirely, otherwise pkBaseURL is no longer defined – which would cause the next block to fail.

Perhaps you could use thiis after your minifier has loaded piwik.js?

<script>
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mysite.com/piwik/" : "http://mysite.com/piwik/");
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>

You were right Anthon.
The issue was in fact due to the place of the Piwik js script and the combined scripts link. It works when located at the end.
Thanks a lot and have a nice day.