- This topic has 7 replies, 2 voices, and was last updated 4 years, 11 months ago by
Elvin.
-
AuthorPosts
-
April 4, 2021 at 12:51 pm #1721351
iou
Hi,
I’m installing google tag manager on my site (using the generatepress theme) and I just want to make sure I do it correctly.
Here are the instructions:
Copy the code below and paste it onto every page of your website.
Paste this code as high in the <head> of the page as possible:Additionally, paste this code immediately after the opening <body> tag:
Here is a link to a google guide:
https://developers.google.com/tag-manager/quickstart
My questions are,
How do I access the <head> of every page and how “high” in the <head> can I place the code on generatepress? Additionally, is there any special method to place the code or can I just paste the code as is in the appropriate area?
Also, for the code that needs to be placed “immediately after opening <body> tag, where can I access and place this on the page?
Thank you for reading and any help!
April 4, 2021 at 9:46 pm #1721542Elvin
StaffCustomer SupportHow do I access the <head> of every page and how “high” in the <head> can I place the code on generatepress? Additionally, is there any special method to place the code or can I just paste the code as is in the appropriate area?
Yes, you can place the code on the theme.
You can use the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/Google’s instruction has 2 codes.
As for the one that’s supposed to go to the
<head>:You can place the code in the code area. You then
wp_headon the hook dropdown. You then set its display rule to “Entire Site”. Leave the priority to default. This is fine, you won’t have to bother w/ how “high” it is placed.As for the one that’s supposed to go immediately after the
<body>tag:You can place the code in the code area. You then
wp_body_openon the hook dropdown. You then set its display rule to “Entire Site”. Set the priority to1.April 6, 2021 at 4:16 pm #1724048iou
Awesome, thank you Elvin. I got it setup. Always surprised at how easy and robust the generatepress theme is!
One last question. I see this on the hooks section,
Execute PHP: Unable to execute PHP as DISALLOW_FILE_EDIT is defined.
I assume this the default standard. Unsure if I ever will, but if I do need to execute php, then how would I do so? Thank you
April 6, 2021 at 6:34 pm #1724103Elvin
StaffCustomer SupportCheck David’s brief explanation about it here:
https://generatepress.com/forums/topic/unable-to-execute-php-as-disallow_file_edit-is-defined-2/#post-1538699April 7, 2021 at 1:08 pm #1725371iou
Okay, thank you.
Alright, this is the last question haha. I used the hooks to setup fb pixel and another piece of code I have. FB pixel needs to be in header of every page. Other code needs to be custom HTML at the bottom of the body tag of the home page.
Settings for FB pixel are:
wp_head
display rule to “Entire Site”
priority to defaultSettings for other code:
wp_body_open
display rule “front page”
priority defaultMy question is do I need to change the priority for either of these? I am actually confused on how the priority function is properly used if you have an article in that.
Thank you
April 7, 2021 at 8:20 pm #1725596Elvin
StaffCustomer SupportNot necessarily but if there should be a priority order between Google’s script and FB’s script, try adding one.
I don’t think it’s required though.
April 10, 2021 at 1:06 pm #1729186iou
Thanks Elvin! You were are great help!
April 11, 2021 at 3:07 pm #1730293Elvin
StaffCustomer SupportNo problem. Glad to be of any help. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.