Solve the parse error with Google Analytics

Posted by Stefan at 12:32 pm
Categories: IT and technology

Sorry for this first “nerdy” comment since we’ve set up this page, but the following error just made me nuts and looking for a solution on the net for hours. ;) I just wanted to save others the time by spreading this simple and quick solution. ;) If you don’t know what “Google Analytics” or a “parse error” is then just forget this post… ;)
If you get the parse error

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ in /www/htdocs/ on line

after using Google analytics code on a php site with the echo command just change the third line of the Google analytics script from

document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));

to

document.write(unescape(”%3Cscript src=\‘” + gaJsHost + “google-analytics.com/ga.js\‘ type=\‘text/javascript\‘%3E%3C/script%3E”));

Worked perfectly fine for me.




No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 3 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a