My client uses a CMS for all his web content development. I tried dumping the Google Analytics code at the bottom of each section in the CMS, but clearly this is still way too far up the page for Google to make use of it. So next I tried getting in behind the CMS via FTP, but found that PHP files aren't exactly east to edit. Is there a good PHP editor out there for Mac OS X? Or a better way to get this @#$ code in there and get on with life? Thanks PB
The solutions is actually easy. I am not, however, familiar with an easy to use editor. Simply put, php files can be divided into two types: those that generate HTML and those that do not. HTML, is of course what is eventually presented to your site visitors and what dictates the appearance of the site. All you need to do is go over the php files, open them with any text editor (notepad will do). Then look for the end of the HTML document - the closing tags </body> and </html>. Place the analytics code right after the </body> tag and that's it. It's actually very easy. The only problem might be if the php itself generates the </body> tag. If that is the case, you need to search for something like: echo "</body>" or print "</body>" and place your analytics code as follows: echo "<analytics code....>" I hope this helps
Can you get into your website's file manager while online? For example, if using Cpanel hosting, there is a file manager you can go into in the cpanel and edit your files. Find the main file in the CMS that as the main </body> tag at the end and insert your analytics code as specified. If your CMS implements templates you would be looking probably for the footer file so that the analytics code is implemented site-wide.
I think you will still need to edit the pages you want to have analytics on. Create an include file and edit all pages.