Not sure if it goes here but correct me if i'm wrong. I added my analytics code in index_body.html and waited 24 hours to see any update. Nothing has changed. Then i tried put it in index.php - just caused me errors. Where would i put the code?
Just open the overall_footer... There you can see the copyright information of phpbb.. Just add the code after that.
You guys saying to put it between the </body> and </html> are simply wrong. There are only two things that should ever go directly inside of the <html></html>, those are <head> and <body>, both of which can contain further child elements. zlib is right, it goes directly before </body>. It can go anywhere else within <head> or <body>, but placing it as close to the end as possible limits any impact that could be caused by a slowdown on the Analytics servers. For phpBB3, in overall_footer.html, if using the default prosilver template, it would look something like this. <div> <a id="bottom" name="bottom" accesskey="z"></a> <!-- IF not S_IS_BOT -->{RUN_CRON_TASK}<!-- ENDIF --> </div> <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"> var pageTracker = _gat._getTracker("UA-1234567-8"); pageTracker._trackPageview(); </script> </body> </html> Code (markup):
Driving a car in reverse will still get me from point A to point B, but that doesn't mean it's the correct way to drive a car. Go ahead and screw your site up if you want, but when you start wondering why browsers act all quirky when you try to change something in the design later, be sure to remember this thread.
Put the google analytics code at the bottom of the code for each page you want stats for. For exact placement, the google analytics help page should tell you.