• Resolved kingo55

    (@kingo55)


    Hi there,

    I’m really impressed with this plugin so far and am currently testing it out on my site: optimisationbeacon.com

    So far my only “issue” is that I have an existing dataLayer defined on the page (further up in the head). Therefore whenever the gtm4wp dataLayer is defined, the existing dataLayer is overridden. ??

    I could probably cobble something together so we use a dataLayer.push({}); but then I’d have to make this change everytime I upgrade. Are there any plans to make it push its variables onto an already existing dataLayer (I believe this feature will become more necessary as tag managers become more widespread).

    Cheers,
    Rob

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

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

    (@duracelltomi)

    Hi Rob,

    I added to the current development version a check that verifies whether the dataLayer variable exists. Using this your data will not be overwritten.

    You can see it in action at duracelltomi.com

    Is it OK for you?

    Cheers,
    Thomas Geiger

    Thread Starter kingo55

    (@kingo55)

    Thanks for the speedy reply Thomas. That’s what I’m looking to do. I normally borrow a little trick out of Google Analytics’ book and shorten it:

    <script type="text/javascript">
    var gtm4wp_datalayer_name="dataLayer";
    dataLayer=dataLayer||[{}];
    </script>

    I’ve updated my blog with it now too.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Option to push variables onto existing dataLayer’ is closed to new replies.