How to add Google Analytics tracking to any PHP website

Here is a short howto how to make Google Analytics working with your PHP code:

1) Get Google Analytics account – http://www.google.com/analytics/

2) Add your webpage using wizard.

3) Create a file “analyticstracking.php” and insert following (marked in red) into the file:

4) Update all your .php files by adding this line:

<?php include_once("analyticstracking.php") ?>

right after the <body> tag in each .php file.

5) Profit! 🙂

Note: It might take some time before Google Analytics start tracking your website so be patient. However it should pick within several minutes hours tops (24h), otherwise som[page_tree][page_tree][page_tree][page_tree][page_tree][page_tree]ething is wrong with your setup.