I came across this article on how to add analytics code to php static pages: http://www.google.com/support/googleanalytics/bin/answer.py?answer=55504&topic=10981 This is a good idea, in case they change the code in future, we just have to change one page rather than having to manually edit many static pages. Now I'm stuck with many static html pages with the old analytics code & I gotta manually change all of them..... bad mistake. I wonder if I can add the footer code on html pages instead of php pages. Here's another article that shows how it can be done: http://msdn2.microsoft.com/en-us/library/aa140051.aspx What do you think?
The first article is pretty good, the second one is useless if you already know PHP (because SSI's are one of the first things you learn about when you learn PHP) Although, I'm sure someone will find it very useful.
Thanks. Anyway does it work if I add an <!--#include virtual="footer.html"--> on all my static pages & footer.html is where I place my analytics code.
at the bottom of your html just use the same code: <?php include("xx.php"); ?> where "xx.php" is the file containing your analytics code
This will only work on php files, I want know how to do it on html files. <!--#include virtual="footer.html"--> I wonder if it will work on both php & html files. Usually I start with html pages then I save them as php, since I'm using FrontPage.
The analytics code should be the same on all your pages (I'm assuming), can you just do a find/replace across all your static pages and update the code?