I used to have a eventlistener that looks something like this:
<script>document.querySelectorAll('.myclass').forEach(item => {
item.addEventListener('click', event => {
gtag('event', 'phoneclick', {
'event_category' : 'contact',
'event_label' : 'phone'
});
});
})</script>
Somehow it fires the event two times. First I thought it was because the class was used more than once. But actually the class is only used for one element on the page.
I am new to this topic, so a beginners-guide would help me a big deal! Thank you very much.