I am trying to add GA to my wp_head hook. Below is the code GA supplies for tracking. I disguised the UA-NUMBER, of course. This is exactly what I added in the hook input box area. Am I missing something? Do I have to tick the “Execute PHP” box?
For anyone who is trying to do this, here’s what worked for me.
I ended up just using the one code snippet (provided by Google) in the wp_head hook, and it works as is.
I went to Google Analytics, Admin, Tracking Info, Tracking Code. Copied everything in the box (see snippet above). Didn’t add anything else, just the GA code snippet.
I didn’t tick the “Execute PHP” box. And I didn’t add anything to the Before Header hook in the body. I actually couldn’t find anything about code in the body. Its working, so I’m just going to leave it as is.