Custom event not getting triggered

Does it make any difference for custom event to be called if element target is blank.

Also the anchor tag opens in another in new tab. Does it mean control gets transferred before the custom event trigger. Can this be rectified using script placement changes or any other way, as the custom attribute works fine.

Element:

a href=“URL*” id=“id” target="_blank">**</a

Script tried and failed:

window.addEventListener(‘DOMContentLoaded’, (event) => {

document.getElementById(‘id’).addEventListener(‘click’,function (e) {
newrelic.addPageAction(‘Doc’);
})

@Mohd.Salman2 Checking in to see if you were able to answer this question? Realize its been awhile…

1 Like

Yes had to trigger custom event from different module which earlier was not getting passed and showing as ‘unnamed transaction’ in chrome.

Thanks.

1 Like

@Mohd.Salman2 Thank you for sharing how you resolved this issue. I’m sure it will be helpful to other community members :slight_smile:

1 Like