Knowledgebase
"Smarty Error" with Google Analytics Tracking Code
Posted by Steve Naqvi on 03 May 2012 03:01 AM

Use {Literal} Smarty Tag to Add Google Analytics Tracking Code

The error happens because Smarty template engine attempts to translate and interpret some keywords in Google Analytics tracking code that conflict with Smarty template delimiter syntax. As a workaround, Smarty does provide tags, {literal} and {/literal}, which allows a block of data to be taken literally.

{literal} tags are 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. It means anything inside the tags will be appeared exactly the same in the final HTML output for web browser to interpret, and no change will be done by Smarty engine.

Thus, to fix Google Analytics tracking code error on BlogSome, just embed the tracking code with{literal} before Google Analytics Javascript code, succeeding with {/literal} after the tracking. For example,

{literal}
Google Analytics Tracking Code Append Here
{/literal}

(5 vote(s))
Helpful
Not helpful

Comments (1)
Think Bacon
13 August 2012 09:01 AM
Excellent info. Saved my site :)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).