[Support request] How to install Google Tag Manager code in the GP Child Theme

Home Forums Support [Support request] How to install Google Tag Manager code in the GP Child Theme

Home Forums Support How to install Google Tag Manager code in the GP Child Theme

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1949945
    Aaron

    Hi Support,

    I need to know how to install this code in the header.php right under the <head> tag in the Generate Press Child Theme. As well as the second code I provider which needs to go under the <body> tag. I believe you do it under the “functions.php” under the theme editor, however, I don’t know how to add it in.

    Paste this code as high in the <head> of the page as possible:
    `<!– Google Tag Manager –>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
    https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,’script’,’dataLayer’,’GTM-KBFF5GN’);</script>
    <!– End Google Tag Manager –>

    Additionally, paste this code immediately after the opening <body> tag:
    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-KBFF5GN&#8221;
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>

    #1950223
    David
    Staff
    Customer Support

    Hi there,

    this document shows you how:

    https://docs.generatepress.com/article/implement-google-tag-manager/

    The first option uses the Elements module which is by the far the simplest method.

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