Why is PHP code in Google analytics code not properly executed? Why is PHP code in Google analytics code not properly executed? wordpress wordpress

Why is PHP code in Google analytics code not properly executed?


The problem you are describing means that the server is not parsing the codes you provided.

In a basic environment that would be caused by using a file type that is not associated with PHP by default (such as .html) and is not being parsed.

In your case, you mention you are using wordpress, I would guess that you have inserted this code in some field that has protection and instead of parsing your code it is then outputting it literally instead.

What you can do is find the file and update it manually instead of using the wordpress UI. Additionally, make sure the file will be parsed by the preprocessor.

Also, if you are using the WordPress wysiwyg editor to add the php code then there are plugins available which can let you run/parse PHP code added there.