Site logo

Archived topic

Adding Google Analytics

1 reply · Started by Conor on September 9, 2019

Viewing posts 1–2 of 2

I was looking in the forum and I saw a lot of stuff about child theme and hooks and I didn't really know what they meant..

I know I have to copy the google analytics code to the header of my website, but I have also read that it can disapear whenever I update my site.. is there anyway to add google analytics and have it on the site without needing to update it?

cheers,
C

Hi there,

you can use the Hook Element:

https://docs.generatepress.com/article/hooks-element-overview/

With the Elements module activated, Appearance > Elements > New Hook.
Add your GA Script to the Content.
Select the WP_Head hook from the Hooks List.
On Display Rules tab set to Entire site.

This won't be affected by updates to the theme.

This archived topic is closed to new replies.