You're right. I found the problem yesterday evening and it is a rather stupid one. I just hat a linefeed in the javascript code.
I thought javascript would be more tolerant against such things. Thanks to all for the suggestions. Fernando Padilla wrote: > > The google code doesn't HAVE to be the last thing on the page. It will > work anywhere on the page. You can bring in the js file normally > through tapestry's addScriptLink (or IncludeJavascript annotation), and > then add the google code through addScript.. > > it would be something like below, but you have to learn how to deal with > tapestry javascript and renderSupport properly. :) > > > > renderSupport.addScriptLink("http://www.google-analytics.com/ga.js"); > renderSupport.addScript( "if (typeof(_gat) == 'object') {var pageTracker > = > _gat._getTracker("${trackerId}");pageTracker._initData();pageTracker._trackPageview();}" > > ); > > > > On 7/28/09 3:27 AM, moritzgilsdorf wrote: >> I tried it but it still inserts the tapestry-code after the GA code and >> before the</body> tag. >> >> Any other suggestions? >> >> >> >> Harald Geritzer wrote: >>> >>> hello, >>> >>> i wrote some custom component for one of my projects. it's included just >>> before the closing body tag. >>> >>> <body> >>> ... >>> >>> >>> </body> >>> >>> >>> GoogleTracker.java >>> ================== >>> >>> public class GoogleTracker { >>> >>> @Paramter >>> private String trackerId; >>> >>> >>> public String getTrackerId() { >>> return trackerId; >>> } >>> } >>> >>> >>> GoogleTracker.tml >>> ================= >>> >>> <t:container >>> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"> >>> <script type="text/javascript"> >>> var gaJsHost = (("https:" == document.location.protocol) ? >>> "https://ssl." >>> : "http://www."); >>> document.write(unescape("%3Cscript src='" + gaJsHost + >>> "google-analytics.com/ga.js' >>> type='text/javascript'%3E%3C/script%3E")); >>> </script> >>> <script type="text/javascript"> >>> if (typeof(_gat) == 'object') { >>> var pageTracker = _gat._getTracker("${trackerId}"); >>> pageTracker._initData(); >>> pageTracker._trackPageview(); >>> } >>> </script> >>> </t:container> >>> >>> moritzgilsdorf schrieb: >>>> Hi, >>>> >>>> I have a problem with using Google Analytics in my project. I've added >>>> the >>>> GA scripts in my Layout.tml just before the closing body tag. When >>>> rendering >>>> the Page, Tapestry inserts between the GA scripts and the</body> the >>>> following code: >>>> >>>> <script type="text/javascript"> >>>> <!-- >>>> Tapestry.onDOMLoaded(function() { >>>> $('gene').activate(); >>>> Tapestry.init({"validate":[["organism",[["required","You must provide a >>>> value for Organism."]]]]}); >>>> }); >>>> // --> >>>> >>>> I suspect this behavior to cause GA to fail. Does anyone has a similar >>>> problem or knows a quick workaround to solve this? >>>> >>>> Thanks in advance! >>>> >>>> Moritz >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://n2.nabble.com/T5%3A-Include-Google-Analytics-Code-tp3200824p3348453.html Sent from the Tapestry Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org