473,395 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem rendering Google Analytics code

49
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 3022
acoder
16,027 Expert Mod 8TB
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
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 Expert Mod 8TB
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
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...
0
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
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...
1
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...
14
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"?>...
1
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:...
0
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...
2
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...
1
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.