Error when adding Google Analytics code to affiliate panel.

 
Post Affiliate Pro uses Smarty template engine so some text needs special care before it can be used. Namely { and } as Smarty uses them to parse the text.
Unfortunately most JavaScript Code also uses curly brackets and can throw error when you simply place JavaScript into Smarty template. Fortunately this can be easily fixed by placing the code between {literal}{/literal} tags, like this:
{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 be executed only if it is placed into a .stpl file due to security reasons.
×