Top Magic Javascript for Daily uses of Google Tag Manager

Standard

Drop-Down list – DOM Ready

<script>
(function() {
var list = document.querySelector(‘xxxxxx’);
list.addEventListener(‘change’, function(e) {
window.dataLayer.push({
event: ‘dropDown-Form’,
selected: this.options[this.selectedIndex].value
});
});
})();
</script>

You need to change querySelector id or Class

Leave a Reply

Your email address will not be published. Required fields are marked *