Tagged: google analytics
We have implemented Google Tag Manager by adding it in the functions.php page. Like this:
function add_custom_gtm(){
?>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-xxxxxx"
title="Google Tag Manager Implementation" 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
}
if (!is_admin())
add_action('wp_head', 'add_custom_gtm');
Is there a way to keep this analytics code from loading on the NOTHING FOUND page that loads when a person attempts to load a URL that does not exist on the site? This is the case when a user has an old bookmarked URL from our old non-WP site.
Hey galpinr,
You could try something like this
if (!is_admin() || !is_404())
If you need further assistance please let us know.
Best regards,
Victoria
Hi Author,
May I know how to install GOOGLE TAG MANAGER into enfold?
Thanks in advance.
Tim