Skip to content

GoogleTagManager invalid input type for dataLayer push #473

Description

@Stacker8

🐛 The bug

Hello,

This change breaks the ability to set the consent mode for GTM.

Spreading the args for the dataLayer push results in an array being added to the dataLayer array. But the dataLayer array ignores entries of js type Array.

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-mxudpoge?file=app.vue,pages%2Findex.vue

🌈 Expected behavior

Instead the dataLayer array expects Arguments objects, which can be achieved by:

window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);}

The fix needs to be applied to the gtag function in onBeforeGtmStart and the proxy push function

ℹ️ Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions