- This topic has 7 replies, 4 voices, and was last updated 5 years ago by David.
-
AuthorPosts
-
March 24, 2019 at 12:46 pm #848484Evan
Hi –
I recently tried to set up Google Analytics by adding my GA tag to the site’s PHP footer. To do this, I had Bluehost support do it for me.
However, when the GA tag was added, my site simultaneously crashed. Bluehost support informed me that the GeneratePress theme was corrupted, something about the PHP not being compatible with Bluehost or something like that.
They were able to switch to another theme and get the site back online, but every time I switch back to the GeneratePress theme, my site crashes with an HTTP 500 error. When I contact Bluehost, they tell me the same thing, that the theme’s PHP files are corrupted and need to be updated.
They’ve told me to reach out to the theme provider for help.
Does any of this make sense? Hopefully. Currently, each time I turn on the GeneratePress theme, the site crashes with a 500 error, and Bluehost tells me only the theme provider can address the PHP issue.
Any help greatly appreciated. The theme has worked great for the past six months or more, and just started crashing the past few days. Perhaps related, I know Bluehost upgraded their PHP on March 13th.
– Evan
March 24, 2019 at 4:41 pm #848591TomLead DeveloperLead DeveloperHi there,
It sounds like the code they added to the theme had errors in it. Is it possible to remove that code from the footer?
If not, you’ll want to delete the theme completely and install it again from scratch.
Then you can add the code using a Hook Element instead: https://docs.generatepress.com/article/hooks-element-overview/
If you’d like to share the code here, we can check it for errors.
March 25, 2019 at 5:44 pm #849790EvanAwesome, I was able to get the site back online by deleting/redownloading, thanks!
Regarding the code, I’ve pasted it below. When using a hook, would I paste the entire GA code below, or just a portion?
Thanks as always!
– Evan
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-100766377-2″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘UA-100766377-2’);
</script>March 25, 2019 at 6:10 pm #849802LeoStaffCustomer SupportThe entire block of code is needed 🙂
March 26, 2019 at 8:20 pm #850950EvanAwesome, thanks!
So, I set up the hook like this screenshot here. I’ve also set the display rules to “entire site” for the location.
However, it doesn’t look like Google Analytics is picking anything up. Am I perhaps using the hook incorrectly?
– Evan
March 27, 2019 at 2:11 am #851088DavidStaffCustomer SupportHi there
if you’re using Google Tag Manager then they provide a second script that has to be added right the opening body tag. This needs to go in a before_header hook.
March 29, 2019 at 4:06 pm #853861EvanGot it to work, thanks!
March 30, 2019 at 4:10 am #854095DavidStaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.