Created
October 18, 2017 08:17
-
-
Save zation/c8e307f193a3f63c2354680ec937cf84 to your computer and use it in GitHub Desktop.
Analytics
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
(function () { | |
document.body.insertAdjacentHTML('beforeend', ` | |
<style> | |
.AnalyticsContainer { | |
position: relative; | |
border: 3px solid red !important; | |
} | |
.AnalyticsContainer:hover > .Analytics { | |
display: block; | |
} | |
.Analytics { | |
position: absolute; | |
top: 0; | |
left: 0; | |
color: red; | |
text-align: left; | |
z-index: 99999; | |
display: none; | |
background: white; | |
padding: 6px; | |
white-space: nowrap; | |
} | |
</style> | |
`); | |
document | |
.querySelectorAll('[data-analyze-on="click"]') | |
.forEach((element) => { | |
element.classList.add('AnalyticsContainer'); | |
element.insertAdjacentHTML('beforeend', ` | |
<div class="Analytics"> | |
<div>Category: ${element.getAttribute('data-event-category')}</div> | |
<div>Name: ${element.getAttribute('data-event-name')}</div> | |
<div>Label: ${element.getAttribute('data-event-label')}</div> | |
</div> | |
`); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment