Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1160823

    Hi,

    I am trying to add google tag manager, but it seems like I can only add the <head> script in the “google analytics tracking code” box.
    Where do I add/paste the <body> script? I.e this script:

    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-M9R8TKM&#8221;
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>

    Thank you in advance!

    BR,
    Emma

    #1161402

    Hey Emmasfm,

    You will need to do this with code, as we do not have an option to add code inside body through our Theme Options.

    Best regards,
    Basilis

    #1184108

    I have the same problem with Emmasfm.
    Here are GTM script:
    GTM script
    – 1st Script: I copy a header.php from the Enfold into the child theme. And then, I paste the 1st script into between the <head>…..</head>
    – 2nd script: I paste after the <body> tag

    But when I check the status of Google Assistant Extension, the yellow color before the Google Tag Manager.
    The yellow color means that at least one Google Tag has a minor issue and the issue should be addressed, otherwise you might face some tracking discrepancies.
    How can I fix it? (You can see more detail in the private content)

    Enfold should have an article guide everyone about Google Tag Manager, I search any available can’t solve the problem.

    #1184319

    Hi ezvisa,

    Please have a look at the following thread:
    https://kriesi.at/support/topic/google-tag-manager-6/

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1184372

    Victoria, Ismael mention about using “wp_header” for put script into header and “wp_footer” for footer.
    But can you write full code for me? Because I have lacked the skill in coding.
    I very much appreciate that!

    #1184677

    Hi ezvisa,

    Please post the full code you are looking to add to your site and where it should go and, we’ll give you some functions to use.

    Best regards,
    Rikard

    #1413830

    Enfold Child > functions.php
    add these lines and change the GTM-Code to your Code.
    /**
    * Google Tag Manager Head Script
    */
    function add_custom_gtm(){
    ?>
    <!– 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-XXXXXXX’);</script>
    <!– End Google Tag Manager –>
    <?php
    }
    add_action(‘wp_head’, ‘add_custom_gtm’);
    /**
    * Google Tag Manager Body Script
    */
    function google_tag_manager_body_code() { ?>
    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX&#8221;
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>
    <?php }
    add_action( ‘ava_after_body_opening_tag’, ‘google_tag_manager_body_code’, 1);

    #1413902

    Hi xxtita,

    Thanks for sharing the code.
    For further information you can check our documentation: https://kriesi.at/documentation/enfold/google-analytics/

    Best regards,
    Nikko

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