Site logo

Archived topic

Can't add google analytics code to GP Hooks (options.php not found)

5 replies · Started by Faye on March 2, 2017

Viewing posts 1–6 of 6

Hi there,

The title says it all really.

When I paste the google analytics tracking code into the head section in GP Hooks and save, it takes me to a 404 page (options.php).

It doesn't do this when I add a meta tag, only the <script>...</script> google code.

Thanks for any advice/suggestions.
Faye.

I think this must be something to do with my host. I deactivated all the plugins except GP and it still didn't save - although the test site I tried it on is now giving me a "Forbidden - you don't have permission to access /site/wp-admin/options.php on this server" error page.

If I add the GA script in the head of GP hooks on a test site running on my local machine, with MAMP, it works.

I tried just adding the script open and close tag on the remote site and it still failed. I removed the 't' from both script tags and it worked - so it's nothing to do with analytics, it's something about saving the script tag itself.

This isn't an issue with GP - it seems to be something specific to my server set-up where I'm hosting sites.

I can add the script tag to the foot section, no problem (ha! crazy), or I can use a GA plugin, so it's not a big problem, but I might contact my host, just because after all this I reeeeeally want to know what's causing the problem.

Will update if I get a solution, just in case anyone else runs across this.

That's super strange - definitely let me know what you find out. If there's anything I need to tweak I'll be sure to do it.

I finally got to the bottom of this and thought I'd share in case anyone else sees the same thing.

My host needed to whitelist a mod_security rule to allow GP Hooks to save with a script tag in the wp_head section.

I haven't had this problem on other hosts, so it's specific to my (super-secure, lol!) hosting plan.

If anyone else has this issue, you need to contact your hosting company and get them to whitelist the relevant mod_security rule - unsure of the specifics, but hosts are pretty good at troubleshooting, so they should be able to fix it for you.

Thanks, Faye! :)

This archived topic is closed to new replies.