Archived topic
Element for code
9 replies · Started by Simone on November 16, 2021
Hi
How can I add my Google Analytics code to the element?
Thank you!
Hi there,
1. Create a new Hook Element.
2. Add your <script> to the Hook Content.
3. Select the Hook: wp_head
4. Set the Display Rule Location to Entire Site.
If you're using Google Tag Manager it provides a second code for adding after the Body Open tag.
If you're using GTM. Then repeat the above for the second code. And change the Hook to wp_body_open
Thank you, David!
YOu're welcome
Hi David, I inserted the code in the hook and location to the entire site. How come it shows in the header?https://www.screencast.com/t/CG1xvAvLlr
Make sure:
1. The hook selected is the wp_head hook.
2. Make sure your code has the relevant tags - see here for an example of adding GTM Codes:
https://docs.generatepress.com/article/implement-google-tag-manager/
I don't find this type of code in Google Analytics. Is there another way I can insert the code in GP theme?
What code are you trying to add ?
Code from Google Analitycs G-Z227365PZ3
You need to get the tracking script from your google analytics account.
See here:
https://support.google.com/analytics/answer/1008080?hl=en#zippy=%2Cin-this-article