I have been scratching my head for quite some time on this.
When using gtag to try and get a client_id it works, but when trying to use the datalayer directly, it does not.
I found this:
When using the gtag function, it loads an argument type object into dataLayer. This is different from a normal array.
I think whatever javascript is watching the dataLayer array, is only executing on "argument" type values.
For this reason, this packages getDataLayer is not useful right now. I think instead it should do something similar to gtag and provide a gtag function on the service which passses it to datalayer.
I have been scratching my head for quite some time on this.
When using gtag to try and get a
client_id
it works, but when trying to use the datalayer directly, it does not. I found this:When using the gtag function, it loads an argument type object into dataLayer. This is different from a normal array. I think whatever javascript is watching the dataLayer array, is only executing on "argument" type values.
For this reason, this packages
getDataLayer
is not useful right now. I think instead it should do something similar to gtag and provide agtag
function on the service which passses it to datalayer.