Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1128729

    Hi,

    I try to install the google Tag manager, I don´t know if it happens because its not the final domain yet.

    I past the head code in enfold google service and the body code in child Theme functions.php

    But it seems not to work.

    #1128789

    Hey jillinnemann,

    Where exactly is that code supposed to go, into the header? If so then we can give you a function to try out.

    Best regards,
    Rikard

    #1128963

    the second part needs to be before die Body tag.
    I red the first part of the header code is finde in your google service section.

    #1129109

    Hi,

    Ok, please try this in your functions.php file:

    function jillinnemann_google_script(){
    ?>
    <!– 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-5R2C5XW’);</script>
    <!– End Google Tag Manager –>
    
    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-5R2C5XW”
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>
    <?php
    }
    add_action('wp_head', 'jillinnemann_google_script');

    Best regards,
    Rikard

    #1129170

    Maybe its because this Sektion needs to be in the body, not the Header?
    The Header code is fine and can be insert into google service.
    may be this part needs a change?

    add_action(‘wp_head’, ‘reybex_google_script’);
    —————

    #1129171

    it needs to be close to the opened body tag

    #1129182

    still same error

    #1129209

    Hi,

    Thanks for that, but we can’t guess where it’s supposed to go. Could you check the documentation to see where exactly it’s supposed to go?

    Best regards,
    Rikard

    #1129217
    #1129440

    Hi,

    Please try this instead:

    function jillinnemann_google_script_after_body(){
    ?>
    THE SCRIPT WHICH IS SUPPOSED TO GO AFTER THE OPENING BODY TAG GOES HERE
    <?php
    }
    add_action('wp_body_open', 'jillinnemann_google_script_after_body');

    Make sure that you are running WordPress 5.2 or higher, otherwise it won’t work.

    Best regards,
    Rikard

    #1140280

    Hi,
    I’m not able to use the hook 'wp_body_open', whereas 'wp_head' and 'wp_footer' works fine.

    Running WordPress 5.2.3 with Enfold 4.2.6.
    No child theme.

    Any suggestion?
    Thanks!

    #1140831

    Hi ClaudioPignoli,

    That hook is not added in the theme version you are running, please update to the latest version (4.6.2) and it should work after that.

    Best regards,
    Rikard

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