momadvisorblog
Forum Replies Created
-
Forum: Plugins
In reply to: [Code Snippets] Google Tag ManagerThank you!
This is what I found in the header.php file.
<!DOCTYPE html>
<html <?php language_attributes(); ?> class=”no-js”>
<head>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
<meta name=”viewport” content=”width=device-width”>
<link rel=”profile” href=”https://gmpg.org/xfn/11″>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”>
<?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<div id=”ds-container” >
<?php do_action(‘dt_before_header’); ?>
<?php
$enable_header_top = esc_attr(get_theme_mod(‘dt_enable_header_top’, DT_ENABLE_HEADER_TOP));
if ($enable_header_top == ‘1’) {
$extra_class = ‘dt-header-top-enabled’;
} else {
$extra_class = ”;
}
?>I added this but there′s an error:
add_action( ‘body_class’, function () { ?>
<!– Google Tag Manager (noscript) –> etcI think it′s adding it before instead of after the <body> tag.
And now I′m getting this line:
class=”home-page bp-legacy geodir_advance_search geodir_custom_posts geodir-page sd-common sd sd-homepage wpb-js-composer js-comp-ver-5.1 vc_responsive elementor-default no-js gd-map-auto”>Help please ??
Forum: Plugins
In reply to: [Code Snippets] Code Snippet for Google AnalyticsShea I think I need to insert it in the body,
would it be then something like this?
add_action( ‘wp_head’, function () { ?>
<!– 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-XXXXXX’);</script>
<!– End Google Tag Manager –><?php }, 1 );
add_action( ‘wp_body’, function () { ?>
<!– 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) –><?php }, 1 );
Forum: Plugins
In reply to: [Code Snippets] Code Snippet for Google AnalyticsThank you Shea!
Forum: Plugins
In reply to: [Code Snippets] Code Snippet for Google AnalyticsHi Shea!
Me again ??
I′m trying to set Google Tag Manager instead of google analytics.
But I′m not sure how to do that, I allready have the code but how do I specify the header and body part?
This is the code Google tag manager gave me
Add in header:
<!– 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-XXXXXX’);</script>
<!– End Google Tag Manager –>Add ater body:
<!– 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) –>Could you please help me with the correct way to set it up?
Best!