[Resolved] Setting up Google Tag Manager Data Layer in GeneratePress

Home Forums Support Setting up Google Tag Manager Data Layer in GeneratePress

  • This topic has 3 replies, 2 voices, and was last updated 1 year ago by Leo.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1002516
    pairfum

    Dear Support Forum,

    We have implemented Google Tag Manger using this excellent guide and it works very well:
    https://docs.generatepress.com/article/implement-google-tag-manager/

    We would now like to add ‘Data Layers’ in Google Tag Manager and we are following this guide:
    https://juliencoquet.com/en/2014/01/22/data-layer-google-tag-manager-for-wordpress/

    Our question is: How do we implement it in GeneratePress?

    We presume by creating a new Hook Element with the following settings:

    – Content > this is where we paste the code from the guide

    – Settings > Hook > ??? -> which hook is best ? According to the link, it should go should go in the WordPress header of the child theme but before Google Tag Manager container snippet

    – Settings > Priority > ??? -> should the priority be zero?

    – Display Rule > Location > Entire Site

    – any other settings, e.g. ‘execute php’ ?

    Many thanks for your help on this.

    Kind regards,

    Pairfum London
    https://www.pairfum.com

    #1002541
    Leo
    Staff
    Customer Support

    Hi there,

    Looks like it should go in wp_head as well.

    Since it needs to go before GTM, you can set the GTM code to priority 5 and this one to priority 2.

    Setting it to the entire site should be good and also execute PHP.

    Let me know 🙂

    #1002679
    pairfum

    Hi Leo,

    Many thanks for your quick response & advice.

    Your tip about setting the priority is very good:
    – 2 for the Data Layer hook, and
    – 5 for the main GTM container.

    I had been wondering how to fire it before the main GTM container in wp_head.

    ‘Entire site’ has been set and ‘execute php’ ticked.

    Again, many thanks for your help.

    Kind regards,

    Pairfum London

    #1002683
    Leo
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.