Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter momadvisorblog

    (@momadvisorblog)

    Thank 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″&gt;
    <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) –> etc

    I 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 ??

    Thread Starter momadvisorblog

    (@momadvisorblog)

    Shea 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&#8221;
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>

    <?php }, 1 );

    Thread Starter momadvisorblog

    (@momadvisorblog)

    Thank you Shea!

    Thread Starter momadvisorblog

    (@momadvisorblog)

    Hi 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&#8221;
    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!

Viewing 4 replies - 1 through 4 (of 4 total)