I would like to know if it is enough to place the GA tracking code in the index file or I have to put it in all the pages? How accurate is it if I put it just in the index?
I used to include it before end of of body code on index page footer, its automatically includes in all other pages.
Thank you for your answer, I know what you are talking about, but I don't have a page footer that includes automatically in all pages.
I read on Google help "Database driven sites - Insert the tracking code on your index.php page or equivalent (eg. default.php, index.cfm)." may this help you.
If your site is PHP enabled you may want to consider creating a PHP include for the footer. It is going to be just as much work to go into every page and past the code why not do an include once then you can update effortlessly in the future. Also with PHP you can do cool things like have the copyright echo the current year. For example at the bottom of each page you say Copyright - mysite.com 2010 In this could setup PHP to simply insert the current year where 2010 is so you don't have to update that each year. Good luck!
If you only post the code within your index page, you will only be able to track people that visit that page only. If you had other pages (ie contactus.php), you wouldn't have record they visited that page.
the code needs to be on every page. How it gets there is another question. I use SSI (Server Side Include). It sounds a little like a PHP script inserting the code at the end of the file, just before </body> the line in my .shtml files look like this <!--#include virtual="/analytics-domain.inc"--> and this .inc file contains the code. Your webhost must support Server Side Include !