General technical question
-
Hello,
I just want to make sure if this kind of behavior is normal, or if I should try to figure out why it happens:
I put the code:
<?php if ( function_exists( 'gtm4wp_the_gtm_tag' ) ) { gtm4wp_the_gtm_tag(); } ?>
right after <body> in header.phpWhen inspecting the DOM I can see that there are 2 blocks of code inserted by the plugin, one of them is all in the header (NO.#1), the other one spans across the <head> and <body> – it starts before </head> and ends after <body> (NO.#2).
Here’s an excerpt for (NO.#1):
<!-- Google Tag Manager for WordPress by DuracellTomi - http://duracelltomi.com --> <em>a facebook scrips.. tawk.to script..</em> <script type="text/javascript"> var gtm4wp_datalayer_name = "dataLayer"; var dataLayer = dataLayer || [] </script> <!-- End Google Tag Manager for WordPress by DuracellTomi -->Here’s an excerpt for (NO.#2):
... some <head> code here... <em><!-- Google Tag Manager for WordPress by DuracellTomi --></em> <script type="text/javascript"> dataLayer.push({"pagePostType":"page","pagePostType2":"single-page","pagePostAuthor":"MyWebsite"}); </script> <strong></head></strong> <strong><body></strong> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-MyID" 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-MyID');</script> <em><!-- End Google Tag Manager --></em> ... some <body> code here...I have 3 questions:
1) Is it OK that I have any code related to the plugin in the <head> where I only called the pulgin’s function after body?
2) Is it OK that I have this kind of code like shown in (NO.#2) where part of the block (according to your comments) is in the <head> and the rest is in the <body>?
3) Is it natural that the comment block of code the plugin inserts surrounds other elements/scripts loaded in the page? (NO.#1)?
Thank you!!
https://ww.wp.xz.cn/plugins/duracelltomi-google-tag-manager/
The topic ‘General technical question’ is closed to new replies.