Support » Plugin: Google Tag Manager for WordPress » Data Layer Not Appearing for Page View Tag

  • Resolved arthurrjw

    (@arthurrjw)


    Reposting from this thread as it’s own ticket: https://wordpress.org/support/topic/visitorloginstate-stopped-working/

    ***

    Been having issues (started 2 weeks ago, working fine before) where (a) I no longer seem able to exclude page views by visitorLoginState or visitorLoginType and (b) ecommerce tracking has stopped working.

    What I’ve found is that visitor variables are NOT being passed to my initial page view tag but are being passed to all subsequent tags.

    See screenshots below:

    Not working on Page View: https://paste.pics/f3271f77228dea8892d6663d6410c91a
    Working on DOM: https://paste.pics/5b0ebb5ab4fb1c03ad182fd39692d4cc

    This means I’m not able to exclude the initial page view tag from firing based on visitorLoginState or visitorLoginType variable (but I am able to exclude later tags using that data once it has loaded).

    Any ideas how to fix this Thomas? I’d like to be able to exclude administrator page views from all my analytics data.

    Thank you!

    N.B., I make live edits to my site and saw a big uptick in direct traffic starting November 7th so that could give a clue as to when the issue started.

    P.s., My enhanced e-commerce tracking via GTM4WP also stopped working around this time (battling with that as well) – not sure if it’s linked?

Viewing 6 replies - 1 through 6 (of 6 total)
  • arthurrjw

    (@arthurrjw)

    Cool – and just to be super specific (with a bit more digging), it appears that the problem is that datalayer is being pushed as a message only AFTER the pageview tag is firing:

    See: https://paste.pics/0732a6079bec25b51c2162e4b83719cb

    Any idea how I can fix this?

    sirrahikkala

    (@sirrahikkala)

    I will join this since I have the same issue with conversion tracking.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    You have added a Global Site Tag into your website for a Google Ads account:

    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'AW-759285953');
    </script>

    Could you move this into your GTM container instead of adding it directly to your page source? I have the feeling that this is causing problems for you as it uses the same dataLayer object as GTM uses.

    Amazing – this appears to have fixed it.

    I was using the “WooCommerce Google Ads Conversion Tracking” plugin by Wolf+Bär Agency – legacy installation I hadn’t switched over after moving to GTM.

    Fix worked. Thank you for the quick and helpful feedback. 🙌

    Best, A

    I have to disagree. Our end is still not working but we have narrowed it to Klarna gateway and they are aware of the issue. https://wordpress.org/support/topic/enhanced-ecommerce-datalayer-and-event/#post-12173051

    Plugin Author Thomas Geiger

    (@duracelltomi)

    I posted to that WP forum thread just recently, I am open to assist resolving this but it is a bit harder for me to see this “in action” due to country constraints.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Data Layer Not Appearing for Page View Tag’ is closed to new replies.