Some popular PHP scripts such as phpLD and PHP Classifieds were developed based on Smarty, adding Analytics code is a bit tricky. The best way is using the tag literal, enclose Analytics code with {literal} and {/literal}.
The following text is from Smarty online manual:
{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax. Anything within {literal}{/literal} tags is not interpreted, but displayed as-is.

