• This plugin looks awesome for getting WP sites instrumented with GA via GTM. However, I am having a problem figuring out how to reference the dataLayer created by your plugin from inside of GTM.

    It seems that the dataLayer created by your plugin is an Array of objects. Therefore, if I want to reference pageCategory, I need to use:

    dataLayer[0].pageCategory

    See the image here: https://i.imgur.com/G9zrK5B.jpg
    However, when I am creating a variable inside of GTM, I have not way to access dataLayer[0]. I have to simply reference “pageCategory”.

    See the image here: https://i.imgur.com/KiUMkU3.jpg

    I feel like I am missing something fundamental here. Looking forward to your response!

    https://www.ads-software.com/plugins/duracelltomi-google-tag-manager/

Viewing 1 replies (of 1 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    Thanks for your kind words! ??

    There was a discussion about this variable recently where we agreed that users will need a string representation of the pageCategory. I will add this to the next version.

    Until then, you could create a dataLayer variable like you showed me on your screenshot and create a custom JS variable that joins the items in the array:

    function() {
      return {{testKey}}.join(', ');
    }
Viewing 1 replies (of 1 total)
  • The topic ‘How to Reference the Plugin's dataLayer inside GTM’ is closed to new replies.