• Resolved kristian79

    (@kristian79)


    Hi

    I am doing an audit for a client that uses WordPress, Complianz plugin and Google Tag Manager.

    I have a question that I hope you can help with.

    Google Tag Manager
    Google Tag Manager is enabled in the Complianz plugin under Statistics – configuration section as shown here:

    https://complianz.io/definitive-guide-to-tag-manager-and-complianz/ under 2. Enabling Tag Manager in Complianz

    When I look in the source code I see the following script in line 1261:

    <script type='text/javascript' src='https://nextmonday.dk/wp-content/plugins/complianz-gdpr/assets/js/complianz.min.js?ver=4.8.2' id='cmplz-cookie-config-js'></script>
    <script type='text/javascript' src='https://nextmonday.dk/wp-includes/js/wp-embed.min.js?ver=5.5.6' id='wp-embed-js'></script>
    <script type="text/javascript" class="cmplz-stats">(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-NNFHC7Q');</script><strong></body></strong>

    Shouldn’t the GTM script be implemented as as far up in the head tag as possible?

    Does the plugin always place the GTM script in the body section?

    Thanks in advance

    Kristian

    • This topic was modified 3 years, 5 months ago by kristian79.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hi @kristian79,

    Complianz indeed places the GTM script in the body section. From the perspective of Google, they would prefer the Analytics script to be placed within the <head> section, as that would result in the script being loaded as early as possible.

    But if you purely look at this based on metrics such as Pagespeed, you might want to load the script in the Footer instead. If you use caching plugins you will undoubtedly have noticed settings that allow you to “defer” Javascript to the footer, which have a noticeable effect on Pagespeed.

    Ideally, you would want a large part of the page to already be loaded before Analytics gets to do it’s job. Otherwise you might miss out on certain interactions, and your data could be incomplete.

    Hope this clarifies.

    Kind regards,
    Jarno

    • This reply was modified 3 years, 5 months ago by jarnovos.
    Thread Starter kristian79

    (@kristian79)

    Hi Jarnovos

    Thanks for the thorough explanation.

    Sincerely,

    Kristan

    Plugin Contributor Mathieu Paapst

    (@paapst)

    Hi @kristian79

    Great to hear that your issue is resolved! Could you tell us what you think of the plugin or the support by casting your Review here? We’d love to hear your feedback!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Complianz & Google Tag Manager etc.’ is closed to new replies.