Archived topic
Keep losing Google Analytics
5 replies · Started by Lucjan on February 15, 2022
Hi,
I never had any problems with Elementor and Astra, but since I changed to GeneratePress, it keeps losing my Google Analytics on average every 7 days or so.
Why?
Lucjan
Hi there,
how have you added your Google Analytics to your site ?
Yes, two years ago, and everything worked for 2 years no problem until I changed the theme. I have to keep adding the tag again and again between the head and body in the editor as it should be, but still, it keeps losing the tag on a weekly basis.
I don't understand why?
I have to keep adding the tag again and again between the head and body in the editor as it should be
Do you mean you add the code to the theme's file?
If so, the code will be erased during each update.
The correct way to do this is to use a hook element to add the code:
https://docs.generatepress.com/article/hooks-element-overview/
Set the hook location to entire site, choose wp_headas the hook.
Thank you so much Ying, I'll do just that 🙂
You are welcome :)