- This topic has 5 replies, 2 voices, and was last updated 3 years, 2 months ago by Tom.
March 2, 2017 at 3:33 am #286044Faye
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.March 2, 2017 at 10:44 am #286224TomLead DeveloperLead Developer
Hmm, personally add GA into GP Hooks.
Can you check for a plugin conflict using #1 on this page?: https://docs.generatepress.com/article/debugging-tips/March 30, 2017 at 2:17 am #299297Faye
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.March 30, 2017 at 10:47 am #299485TomLead DeveloperLead DeveloperMay 15, 2017 at 6:27 am #318161Faye
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.May 15, 2017 at 9:04 am #318231
- You must be logged in to reply to this topic.