Created
November 15, 2018 10:56
-
-
Save EmilienD/3ce58422d589edcae1381dab7e97a95c to your computer and use it in GitHub Desktop.
Showing the current state of the dataLayer in a few lines of javascript
This file contains hidden or 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
| var dataLayerDisplayer = document.createElement('div') | |
| dataLayerDisplayer.style= "font-size: 8; background-color: rgba(255,255,255,0.5); position: fixed; top:0; left: 0; z-index: 9001; max-height: 50vh; overflow: scroll;" | |
| dataLayerDisplayer.id = "dataLayerDisplayer" | |
| document.querySelector('body').append(dataLayerDisplayer) | |
| setInterval(() => document.querySelector('#dataLayerDisplayer').innerHTML = JSON.stringify(dataLayer.concat().reverse(), null, 2).split('\n').join('<br>').split(' ').join(' '), 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment