Last active
August 29, 2015 14:11
-
-
Save msure/f27be2f7c99e874113fc to your computer and use it in GitHub Desktop.
Console.log changes to Google Tag Manager's dataLayer (works in Chrome)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* 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