Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1446876

    Can you please let me know how to add the Google tags to the site this is what I was provided for a Google ad campaign, the person setting it up sent me this code to add to each <head> section of each page

    #1446886

    Hey schwabino,
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function custom_script() { ?>
      <script>
    <!– Google Tag Manager –>
      </script>
      <?php
    }
    add_action( 'wp_head', 'custom_script', 99 );

    and replace <!– Google Tag Manager –> with your code.

    Best regards,
    Mike

    #1446888
    This reply has been marked as private.
    #1446890

    Hi,
    I will please provide a admin login.

    Best regards,
    Mike

    #1446982
    This reply has been marked as private.
    #1447012

    Hi,

    Thank you for the info.

    The theme is not updated to the latest version 5.7.1. Please update the theme, then add this code in the functions.php file:

    function ava_g_tag_custom_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-TX8QJW27');
        </script>
        <!-- End Google Tag Manager -->
    
        <!-- Google Tag Manager (noscript) -->
        <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TX8QJW27"
        height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
        <!-- End Google Tag Manager (noscript) -->
    <?php }
    add_action( 'wp_head', 'ava_g_tag_custom_script', 99 );
    

    We also recommend installing a child theme so that you can place and preserve the code in the child theme’s functions.php file: https://kriesi.at/documentation/enfold/child-theme/

    Best regards,
    Ismael

    #1447107
    This reply has been marked as private.
    #1447108
    This reply has been marked as private.
    #1447142

    Hi,

    Thank you for the update.

    We added the code to the parent theme’s functions.php file. Please note that this code will be removed when you update the theme. We recommend installing a child theme or using a code injector such as the following:

    // https://wordpress.org/plugins/wp-coder/
    // https://wordpress.org/plugins/insert-php-code-snippet/

    Best regards,
    Ismael

    #1472819
    This reply has been marked as private.
    #1472821
    This reply has been marked as private.
    #1472856

    Hi,

    Did you try adding the code to your code snippets plugin? If that is not an option for you, then please install a child theme and add it as a function instead. Mike and Ismael has provided you with all the necessary information earlier in this thread.

    Best regards,
    Rikard

    #1472940
    This reply has been marked as private.
    #1472952

    Hi,

    We are not familiar with that plugin unfortunately, could you try searching their documentation maybe? If not, there are instructions in this thread on how to add code using a function in your child theme.

    Best regards,
    Rikard

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