Site logo

[Resolved] Install google tag manager

Home Forums Support [Resolved] Install google tag manager

Home Forums Support Install google tag manager

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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!

    #1721542
    Elvin
    Staff
    Customer Support

    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?

    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_head on 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_open on the hook dropdown. You then set its display rule to “Entire Site”. Set the priority to 1.

    #1724048
    iou

    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

    #1724103
    Elvin
    Staff
    Customer Support
    #1725371
    iou

    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 default

    Settings for other code:

    wp_body_open
    display rule “front page”
    priority default

    My 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

    #1725596
    Elvin
    Staff
    Customer Support

    Not 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.

    #1729186
    iou

    Thanks Elvin! You were are great help!

    #1730293
    Elvin
    Staff
    Customer Support

    No problem. Glad to be of any help. 😀

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.