View Full Version : How do you put google analytics into php.?

Jan 15th, 2009, 07:39 PM
I have an arcade games site. php. Tried to put google analytics into the index.php template code and it wouldn't work.. site came up with this message "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bnwsdwpa/public_html/templates/delta/index.php on line 7"
I am a newb so any help would be appreciated. Knowing me its probably really simple to fix. Thanks .

Jan 15th, 2009, 08:37 PM

The Google Analytics code goes in the <head> of the page, so it doesn't matter if it is a php or an html file.


Jan 15th, 2009, 08:39 PM
But DON'T put it in between the PHP tags. (:

Jan 19th, 2009, 03:43 PM
Regarding correct placement of the Analytics code...

Basic installation - Copy and paste the code segment into the bottom of your content, immediately before the </body> tag of each page you are planning to track. If you use a common include or template, you can enter it there.

This is according to http://www.google.com/support/googleanalytics/bin/answer.py?answer=66983&topic=11126