Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Console.log changes to Google Tag Manager's dataLayer (works in Chrome)
/*
*
* Pop this puppy into your Chrome console on a page where you need to observe changes to the dataLayer
* http://updates.html5rocks.com/2012/11/Respond-to-change-with-Object-observe
*
*/
function chaChaChaChaChanges(changes) {
n = dataLayer.length-1;
console.dir(dataLayer[n]);
};
Object.observe(dataLayer,chaChaChaChaChanges);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment