Tagged: x
-
AuthorPosts
-
March 5, 2017 at 12:28 pm #1395254
MauricioParticipantHi,
I’m trying to install GTM tag in the child’s theme functions.php, its seems that is correct but the tag assistant doesnt recognize it.
¿Can you see any mistake?
/*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’,’GTM-MGRR545′);</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
// =============================================================================Thanks a lot!!
March 5, 2017 at 9:16 pm #1395630
Rue NelModeratorHello There,
Thanks for writing in! I guess this is a duplicate post.
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.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1395254 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
