Jump to content

Google Tag Manager (GTM) JavaScript code not found as a direct child of the <head> tag


Recommended Posts

hi

i want connect google tag manager to my website https://ventureonerealtyllc.com/ , after creating google tag manager account i copied code to header.php

<!-- 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-BZZSQ00');</script>
<!-- End Google Tag Manager -->
</head>

<?php
$object_id      = get_queried_object_id();
$c_page_id      = Avada()->fusion_library->get_page_id();
$wrapper_class  = 'fusion-wrapper';
$wrapper_class .= ( is_page_template( 'blank.php' ) ) ? ' wrapper_blank' : '';
?>
<body <?php body_class(); ?> <?php fusion_element_attributes( 'body' ); ?>>
    <!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-BZZSQ00"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

I put it correctly to header.ph file but i got error through tag assistant google chrom extension

GTM JavaScript code not found as a direct child of the <head> tag

 

please sombody help  what can i do??

thank you

Share this post


Link to post
Share on other sites

header.php? Where should that be, what Presta version are you using? You can't put Javascript code directly in a PHP file

You should find the smarty template file of your (child) theme where the <head> tag is created and insert it there. For example themes\classic\templates\_partials\head.tpl in lastest Prestashop 1.7.7.2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More