Error when adding JavaScript (Google Analytics) code to affiliate panel

Post Affiliate Pro utilizes the Smarty template engine, which requires special attention when inserting certain types of text. In particular, the characters { and } are significant because Smarty uses them to parse template code.

JavaScript code often contains curly brackets, and directly placing JavaScript into a Smarty template may result in errors. Fortunately, this issue can be resolved by enclosing the JavaScript code within {literal} and {/literal} tags, as shown below:

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

<script type="text/javascript">
try {
    var pageTracker = _gat._getTracker("UA-xxxxxx-x");
    pageTracker._trackPageview();
} catch(err) {}
</script>
{/literal}

NOTE: JavaScript code will only be executed if it is placed in a .stpl file for security reasons.

×