Google analytics codes etc

Hi,

In my 2.1 installation, i had some tracking codes (javascript I think) That worked for google analytics, piwik and "chcounter". the google and chcounter i would like to have working properly in the new website..
I had put them in footer.tpl.php in 2.1 site

Anyone know if there a place where I should best try to put these codes?

The codes also try to get the (SEO) url and page title too for the counter(s)

// <![CDATA[
// chCounter
// settings:
cstatus = "active";
visible = "1";
page_title = "<?php echo $this->TITLE; ?>";
url_of_counter_file = "http://www.de-digitale-bemoediging.nl/counter/counter.php";

////////////////
page_url = unescape( location.href );
referrer = ( document.referrer ) ? document.referrer : "";
page_title = ( page_title.length == 0 ) ? document.title : page_title;
document.write( "<script type=\"text/javascript\" src=\"" );
document.write( url_of_counter_file + "?chCounter_mode=js&amp;jscode_version=3.1.3&amp;status=" + cstatus + "&amp;visible=" + visible + "&amp;page_title=" + encodeURIComponent( page_title ) );
document.write( "&amp;page_url=" + encodeURIComponent( page_url ) + "&amp;referrer=" + encodeURIComponent( referrer ) + "&amp;res_width=" + screen.width + "&amp;res_height=" + screen.height + "\"><" + "/script>" );
// ]]>
</script>
<noscript>
 <object data="http://www.de-digitale-bemoediging.nl/counter/counter.php?chCounter_mode=noscript" type="text/html"></object>
</noscript></td>
        <td align="center" valign="top" style="border-top:1px solid #68A7DA;border-bottom:1px solid #68A7DA;padding:5px;"  class="header">
</td>
    </tr>
    </table>
</div>
</div>

<!-- Piwik -->
<a href="http://piwik.org" title="Web analytics" onclick="window.open(this.href);return(false);">
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.de-digitale-bemoediging.nl/piwik/" : "http://www.de-digitale-bemoediging.nl/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<!--
piwik_action_name = document.title;
piwik_idsite = 1;
piwik_url = pkBaseURL + "piwik.php";
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
//-->
</script><object>
<noscript><p>Web analytics <img src="http://www.de-digitale-bemoediging.nl/piwik/piwik.php" style="border:0" alt="piwik"/></p>
</noscript></object></a>
<!-- /Piwik --> 

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-*********-**");
pageTracker._initData();
pageTracker._trackPageview();
</script>

http://www.de-digitale-bemoediging.nl/counter/counter.php