I've got a site located with an Apache web server. Someone else uploads static HTML files to some folder every week via FTP produced from 3rd party software.

I'm searching to place Goggle Statistics code on each page when it's made while protecting the URL's, original HTML, and procedure for uploading. I don't know once the files are submitted or even the page names (you will find hundreds of files submitted every time).

I initially considered setting the HTML to become parsed using the PHP engine however, this isn't appropriate because the pages don't contain PHP code and I don't customize the HTML pages through find and replace.

It is possible to method to make use of the PHP engine to process the page inserting code right before the finish from the page as well as other approach?

Well this is an easy way, jsut to provide you with a concept

inshtaccess within the top level directory from the released html files:

RewriteCond %{REQUEST_URI} ^/path/in/question/if/not/document/root/(.+\.html)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.+)$ index.php [L]

in index.php:

   $ga = 'your ga tracking code';



      $content = file_get_contents($file);

      if(false !== ($pos = strpos($content, '</body>')))
         $content = substr($content, 0, $pos).$ga.substr($content, $pos);

      print $content;

If you are using a .htaccess file to possess php parse html files, you should use the php auto prepend/append to include some php code to some file. Read this and search for auto prepend or append to learn to instantly incorporate a file. This is often completed in b .htaccess also. To obtain apache to create php parse html files, you are able to look at this for many info. I simply thought it was through google. You need to have the ability to use these two to incorporate a php file to any or all the html files.

Edit: only a note, there does not have to be php within the html files with this to operate too. php will just search for the various components from the files with php (that is no file) and skip something that does not have php.