Hi Chaps!
I’ve been reading through various threads about the issues when setting up tag manager and have tried a couple of them! More than once…
My client is getting a tad frustrated but I’m running out of ideas as to why this issn’t working?
Is there any chance someone could have a look at tenav.co.uk for me, happy to provide credentials if required.
Google Tag manager installed.
I have this in my child theme in a new _header.php file
/wp-content/themes/x-child/framework/legacy/cranium/headers/views/global/_header.php
<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM- XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id="x-root" class="x-root">
<?php do_action( 'x_before_site_begin' ); ?>
<div id="top" class="site">
<?php do_action( 'x_after_site_begin' ); ?>
And this under functions.php
wp-content/themes/x-child/functions.php
// Additional Functions
//=============================================================================
add_action( 'wp_head', 'add_head_script', 999 );
function add_head_script(){
?>
<!-- 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-XXXXXXX');</script>
<!-- End Google Tag Manager -->
<?php
}