Tracking code integration

Hi!

When I am generating the Piwik tracking code via the admin interface, I am told that I should place the tracking code just before the closing tag.

Here is stated that you should "copy and paste the Javascript tracking code into your pages, just after the tag"
http://developer.piwik.org/guides/tracking-javascript-guide

What is correct?

I am using Piwik 2.12.1.

Thanks and best regards
hulotte

Is the code placment specific for the respective version?

The Piwik website uses the Tracking-Code just before the closing tag. So why is it stated otherwise in the Developer Docs?

It doesn’t matter.

The point is that the code must appear somewhere between the and the tags, so that it’s part of the body of the document.

But does that not have impact on the performance/loading time of the website when placed right after the tag, e.g. when the Piwik instance is not responding?

I don’t think so.

It used to be that the tracking code invoked Piwik in “synchronous” mode. The page would stop loading until Piwik had done its thing. Now, Piwik is invoked in “asynchronous” mode so that the page will start the Piwik functions and then continue doing its thing while Piwik does whatever it needs to do in another processing thread.

I have probably simplified things a little too much, but that’s the gist of it as I understand it. If I’m wrong about this, I’m sure someone more knowledgeable will correct me.