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.
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}
Related Articles
- WordPress Plugin: Display Google Analytics and FeedBurner Reports Statistics from Site Admin
- Official Google Analytics Blog Offers Tips and Information
- How to Remove or Delete (Unlink) Google AdSense and Analytics Integration
- Google Analytics for Mobile Server-Side Tracks Mobile Phone and PDA Devices
- Add and Embed Google Universal Gadgets Modules to Websites and Blogs
- Free Google Trifecta Webinar on Webmaster Tools, Analytics and Website Optimizer
- Implement Ad Revenue Sharing in Blogger (Supports Google AdSense And Any Code)
- How to Add and Publish SPF Records for Google Apps Hosted Domains
- Search for Humyo Hosted Files Download Links with Google
- Flight Tracking Tool by Google










































September 4th, 2009 10:24
i try to search for tutorial to add google adsense in to free wordpress blog