Where to paste Google Tag Manager snippet
-
Ive been reading that it is directly after the body tag in the header.php file. Below is my header.php file but I do not know if i pasted the code in the right place, since I am new to coding and the body tag is not by itself. Does this look right? Any guidance much appreciated.
Thank you in advance
<?php /** * The Header for Customizr. * * Displays all of the <head> section and everything up till <div id="main-wrapper"> * * @package Customizr * @since Customizr 1.0 */ ?> <!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" <?php language_attributes(); ?>> <![endif]--> <!--[if IE 8]> <html class="ie ie8" <?php language_attributes(); ?>> <![endif]--> <!--[if !(IE 7) | !(IE 8) ]><!--> <html <?php language_attributes(); ?>> <!--<![endif]--> <?php //the '__before_body' hook is used by TC_header_main::$instance->tc_head_display() do_action( '__before_body' ); ?> <body <?php body_class(); ?> <!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <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= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-XXXXXX');</script> <!-- End Google Tag Manager --> <?php echo apply_filters('tc_body_attributes' , 'itemscope itemtype="https://schema.org/WebPage"') ?>> <?php do_action( '__before_page_wrapper' ); ?> <div id="tc-page-wrap" class="<?php echo implode( " ", apply_filters('tc_page_wrap_class', array() ) ) ?>"> <?php do_action( '__before_header' ); ?> <header class="<?php echo implode( " ", apply_filters('tc_header_classes', array('tc-header' ,'clearfix', 'row-fluid') ) ) ?>" role="banner"> <?php // The '__header' hook is used with the following callback functions (ordered by priorities) : //TC_header_main::$instance->tc_logo_title_display(), TC_header_main::$instance->tc_tagline_display(), TC_header_main::$instance->tc_navbar_display() do_action( '__header' ); ?> </header> <?php //This hook is used for the slider : TC_slider::$instance->tc_slider_display() do_action ( '__after_header' ) ?>
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Where to paste Google Tag Manager snippet’ is closed to new replies.