Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1395236
    Mauricio
    Participant

    Hi,

    I having a lot of trouble installing Google Tag Manager,

    I’ve tried using this, but it didn´t work. Would you recommend maybe use duracell tomi’s tag manager? I cant find the opening head tag.

    (i delete GTM ID, but is this )

    /*THIS CODE WILL BE OUTPUT INSIDE THE <HEAD> tag*/
    add_action(‘wp_head’,’my_tracking’, 1);
    function my_tracking () { ?>
    <!– Google Tag Manager –>

    <!– 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’,”);</script>
    <!– End Google Tag Manager –>

    <!– End Google Tag Manager –>
    <?php }

    // Add Google Tag Manager Code
    // =============================================================================
    function add_google_tag_manager_code(){
    ?>

    <!– Insert Google Tag Code starts here –>

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

    <!– Insert Google Tag Code ends here –>

    <?php
    }
    add_action( ‘x_before_site_begin’, ‘add_google_tag_manager_code’ );
    // End Add Google Tag Manager Code
    // =============================================================================

    #1395620
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Assuming you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.

    // THIS CODE WILL BE OUTPUT INSIDE THE <HEAD> tag
    // =============================================================================
    add_action('wp_head','my_tracking', 1);
    function my_tracking () { ?>
    	<!– Google Tag Manager –>
    
    	<!– 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',");</script>
    	<!– End Google Tag Manager –>
    
    	<!– End Google Tag Manager –>
    <?php }
    
    // Add Google Tag Manager Code
    // =============================================================================
    function add_google_tag_manager_code(){
    ?>
    
    	<!– Insert Google Tag Code starts here –>
    
    	<!– Google Tag Manager (noscript) –>
    	<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MGRR545"
    	height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    	<!– End Google Tag Manager (noscript) –>
    
    	<!– Insert Google Tag Code ends here –>
    
    <?php
    }
    add_action( 'x_before_site_begin', 'add_google_tag_manager_code' );
    // End Add Google Tag Manager Code
    // =============================================================================

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1395236 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>