473,547 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem rendering Google Analytics code

49 New Member
I am trying to include this code in the footer.template files of all blog templates:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  3. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  4. </script>
  5. <script type="text/javascript">
  6. try{
  7. var pageTracker = _gat._getTracker("UA-xxxxxx-x");
  8. pageTracker._trackPageview();
  9. } catch(err) {}</script>
However, the actual blogs are rendering it like this:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  3. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  4. </script>
  5. <script type="text/javascript">
  6. try catch(err) </script>
with this error also displayed:

Expand|Select|Wrap|Line Numbers
  1. Exception message: Smarty error: [in ./templates//FallingLeaves/footer.template line 16]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590)
  2. Error code: 256
  3. -- Backtrace --
  4. /home/blogs/class/template/smarty/Smarty.class.php(1095): trigger_error
  5. /home/blogs/class/template/smarty/Smarty.class.php(1817): smarty_compiler.trigger_error
  6. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(2218): smarty_compiler._trigger_fatal_error
  7. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(590): smarty_compiler._syntax_error
  8. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(312): smarty_compiler._compile_tag
  9. /home/blogs/class/template/smarty/Smarty.class.php(1491): smarty_compiler._compile_file
  10. /home/blogs/class/template/smarty/Smarty.class.php(1424): cachedtemplate._compile_source
  11. /home/blogs/class/template/smarty/Smarty.class.php(1869): cachedtemplate._compile_resource
  12. /home/blogs/class/template/template.class.php(145): smarty._smarty_include
  13. /home/blogs/tmp/583/%%8B^8B4^8B48D04F%%postandcomments.template.php(192): cachedtemplate._smarty_include
  14. /home/blogs/class/template/smarty/Smarty.class.php(1265): include
  15. /home/blogs/class/template/cachedtemplate.class.php(43): smarty.fetch
  16. /home/blogs/class/view/smartyview.class.php(257): cachedtemplate.fetch
  17. /home/blogs/class/view/blogview.class.php(286): smartyview.render
  18. /home/blogs/class/view/viewarticleview.class.php(88): blogview.render
  19. /home/blogs/class/controller/controller.class.php(399): viewarticleview.render
  20. /home/blogs/showblog.php(51): blogcontroller.process
  21.  
  22. Exception message: Smarty error: [in ./templates//FallingLeaves/footer.template line 17]: syntax error: unrecognized tag: (Smarty_Compiler.class.php, line 446)
  23. Error code: 256
  24. -- Backtrace --
  25. /home/blogs/class/template/smarty/Smarty.class.php(1095): trigger_error
  26. /home/blogs/class/template/smarty/Smarty.class.php(1817): smarty_compiler.trigger_error
  27. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(2218): smarty_compiler._trigger_fatal_error
  28. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(446): smarty_compiler._syntax_error
  29. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(312): smarty_compiler._compile_tag
  30. /home/blogs/class/template/smarty/Smarty.class.php(1491): smarty_compiler._compile_file
  31. /home/blogs/class/template/smarty/Smarty.class.php(1424): cachedtemplate._compile_source
  32. /home/blogs/class/template/smarty/Smarty.class.php(1869): cachedtemplate._compile_resource
  33. /home/blogs/class/template/template.class.php(145): smarty._smarty_include
  34. /home/blogs/tmp/583/%%8B^8B4^8B48D04F%%postandcomments.template.php(192): cachedtemplate._smarty_include
  35. /home/blogs/class/template/smarty/Smarty.class.php(1265): include
  36. /home/blogs/class/template/cachedtemplate.class.php(43): smarty.fetch
  37. /home/blogs/class/view/smartyview.class.php(257): cachedtemplate.fetch
  38. /home/blogs/class/view/blogview.class.php(286): smartyview.render
  39. /home/blogs/class/view/viewarticleview.class.php(88): blogview.render
  40. /home/blogs/class/controller/controller.class.php(399): viewarticleview.render
  41. /home/blogs/showblog.php(51): blogcontroller.process
  42.  
  43. Exception message: Smarty error: [in ./templates//FallingLeaves/footer.template line 17]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)
  44. Error code: 256
  45. -- Backtrace --
  46. /home/blogs/class/template/smarty/Smarty.class.php(1095): trigger_error
  47. /home/blogs/class/template/smarty/Smarty.class.php(1817): smarty_compiler.trigger_error
  48. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(2218): smarty_compiler._trigger_fatal_error
  49. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(590): smarty_compiler._syntax_error
  50. /home/blogs/class/template/smarty/Smarty_Compiler.class.php(312): smarty_compiler._compile_tag
  51. /home/blogs/class/template/smarty/Smarty.class.php(1491): smarty_compiler._compile_file
  52. /home/blogs/class/template/smarty/Smarty.class.php(1424): cachedtemplate._compile_source
  53. /home/blogs/class/template/smarty/Smarty.class.php(1869): cachedtemplate._compile_resource
  54. /home/blogs/class/template/template.class.php(145): smarty._smarty_include
  55. /home/blogs/tmp/583/%%8B^8B4^8B48D04F%%postandcomments.template.php(192): cachedtemplate._smarty_include
  56. /home/blogs/class/template/smarty/Smarty.class.php(1265): include
  57. /home/blogs/class/template/cachedtemplate.class.php(43): smarty.fetch
  58. /home/blogs/class/view/smartyview.class.php(257): cachedtemplate.fetch
  59. /home/blogs/class/view/blogview.class.php(286): smartyview.render
  60. /home/blogs/class/view/viewarticleview.class.php(88): blogview.render
  61. /home/blogs/class/controller/controller.class.php(399): viewarticleview.render
  62. /home/blogs/showblog.php(51): blogcontroller.process
I'd be quite grateful for any help!
Dec 29 '08 #1
3 3030
acoder
16,027 Recognized Expert Moderator MVP
This looks like a PHP (Smarty template) error rather than a JavaScript error. Most likely it's caused by the { which may need to be escaped.
Dec 31 '08 #2
knkk
49 New Member
Thanks, acoder, I got this. I had to put a {literal} tag before and after the javascript. Have a great day (and a Happy New Year!).
Dec 31 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
And you too! Glad you got it fixed.
Dec 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2355
by: David Chang | last post by:
Hi, does any one know how google analytics (urchin.js) works? I always thought javascript cannot talk to multiple servers due to security constraints. But google analytics seems to be able to track down a user's web browsing activities and send them back to google. I deeply appreciate that if some one can shed some light on me regarding...
0
1077
by: Ansuiya | last post by:
hii Can any 1 tell me which is fast ? AWstat or google analytics.Google Analytics takes too much time for processing but i dnt know about AWstat.Help please.. Thanx
1
1100
by: dynamicsolvers | last post by:
Dear All, I am working in a .NET project. Now i want to transfer it from 1.1 to 2.0. I know using VS2005 Conversion wizard, i can transfer the project easily. i did it and after that when i build it, it generated error. In my 1.1 project there are some aspx file which contains only the following code.. <!-- GOOGLE ANALYTICS -->...
1
1649
by: jazzdrums | last post by:
Hello, we have migrated our website from .NET 1.1 to .NET 2.0. After this, some of our users are unable to log-on our site, while for the majority of them there's no problem. We're using a standard procedure to login (see below). The Request.Cookies returns NULL, after their login attempt, on subsequent pages. We're setting other
14
8613
victorduwon
by: victorduwon | last post by:
Hi guys and gals, I am using javascript to autologin to my google analytics account via a hyperlink. This is what the text looks like this <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"...
1
10746
by: sunnyluthra1 | last post by:
Hi, I was creating an Application in MS Access for Geocoding a particular Address from Google to get the Lat & Long. I successfully able to did that. Here is the code: **************************** On Error Resume Next 'if address not found, just move along Dim xml_document As DOMDocument Set xml_document = New DOMDocument...
0
1011
by: firebox | last post by:
Hello, here is the problem i meet during sql request in php. Some links, after request are replaced by one of the variables : FR::GOOGLE-ANALYTICS EN::GOOGLE-ANALYTICS depending the language the user chose.... The is no return after requesting..... 1) I am the only one person meeting this problem (maybe depending the
2
3775
by: shapper | last post by:
Hello, On a custom Web.Config section I keep having the same error. This is driving me crazy!!! I keep having the following error: Unrecognized attribute 'Type'. Note that attribute names are case- sensitive. (C:\Documents and Settings\Miguel\My Documents\Website \web.config line 42)
1
1343
by: tatipellinaresh | last post by:
Hi, I want to use visitor tracking in my web application which is similar to Google Analytics. But in case of google we have to use their script file and they will store out site's data into their server. I want to implement in similar way to google. Please anybody can give the sample code for website tracking. Thanks Naresh
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7794
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.