Set tracking code for all pages from one place in JSF


Hi friends,
I am new to PiWik. I am developing a Liferay project, where I want to use Piwik API for tracking the page visits for all pages. Now I just want to know that is there any way to write the tracking code in one place and that will work for all pages, OR I have to paste the tracking code in every page?

One more thing: Should I paste the javascript tracking code inside or before ?

Thanks & Regards,