Skip to content

Instantly share code, notes, and snippets.

@msure
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msure/f27be2f7c99e874113fc to your computer and use it in GitHub Desktop.
Save msure/f27be2f7c99e874113fc to your computer and use it in GitHub Desktop.
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