Skip to content
Advertisement

Tag: key-value-observing

What is the pattern used by Google Tag Manager in order to observe de `dataLayer` Array?

I observed the dataLayer array and I don’t see any changes to push. No custom methods at all, actually. How is GTM observing the changes to the array? As far as I know, changes to an Array don’t throw any events, do they? Edit: I did some more research and found Google’s library for interacting with the dataLayer: https://github.com/google/data-layer-helper#listening-for-messages I’ll

Advertisement