Basically, with the pre-0.4.0 piwik.js, we recommend the tracking code be inserted just before the closing tag. This would generally correspond to the page footer.
You may want to ask your CMS developers as it depends on your CMS. If the CMS uses/implements some form of templating engine, it is possible that the “footer” is an existing file included when generating the page.
You could put it into a separate .js file but that adds to the page load time and takes up an extra inode. Inline is the recommended method and is the convention used.
In piwik 0.4.0, the placement of the tracking code won’t be as rigid.