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

BlogSome is a free WordPress based web hosting service, which has been a popular choice before arrival of WordPress.com for bloggers who want a WordPress blogging platform without forking out a dime. Even BlogSome still uses the legacy WordPress version 1.5.1-alpha, it still attract some bloggers as it allows blogger to add and place own ads such as Google AdSense on the blog.

BlogSome has been using Smarty template engine as its presentation framework. As a result, when user adds Google Analytics tracking code by placing either new tracking code (ga.js) or legacy tracking code (urchin.js) in BlogSome HTM source code (accessible via Manager -> Files), the following error occurs when any web pages on the blog is opened or visited.

Smarty syntax error

File index.html, line 280: syntax error:
unrecognized tag ‘var’

If you own this blog, and wish to fix this problem, you can log in here.

Google Analytics Tracking Code BlogSome Error

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}


One Response to “Use {Literal} Smarty Tag to Add Google Analytics Tracking Code to BlogSome Hosted Blogs”

  1. @hmad
    September 4th, 2009 10:24
    1

    i try to search for tutorial to add google adsense in to free wordpress blog

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

smarty google analytics - google analytics smarty error - smarty literal - google analytics smarty - google analytics code smarty - html literal tags - search google literal - add blog to google - syntax error: unrecognized tag 'literal' - smarty $ conflict - smarty literal tag - unrecognized tag 'var' in adsense - blogsome.com smarty meta keyword - installing google analytics in smarty templates - google analytics and smarty - mediashare syntax error: unrecognized tag 'var' - add meta keyword with smarty - smarty google analytics tag - add google adsense to smarty - google adsense in smarty templates - "unrecognized tag 'LITERAL'" smarty - add in smarty - smarty php + where to put analytics code - smarty tagi javascript - adding analytics in free wordpress blog - missing { before try block google anal smarty - smaty template google analytics - Add google analytics to free wordpress site - blogsome put tags - google analytics tracking code smarty - literal smarty tag - smarty embed google analytics - smarty code in javascript - smarty lower greek - smarty and javascript unrecognized tag - var tag in smarty - blogsome smarty - google analytics w smarty - google analytics tracking code missing opening { - google analytics tracking code missing opening { - google literal - smarty templates google analytics - template erro try { anal - wordpress google anal - {/literal} code - {literal} tracking code google analytics - analytics tracking code php - blogsome mobile - google analytics tracking code error )); - google analytics code in javascript -