Event tracking not working

Hi,

I have a friend who is using some event tracking, but they are saying the code is not working. I am still to find out what they mean by this, but can anyone see anything wrong with this code?

<option value="https://www.external-website.com" rel="nofollow" onClick="trackOutboundLink(this, 'Outbound', 'External Website Name'); return false;" target="_blank">External Website</option>

Thanks

What is the trackOutboundLink function doing?
Any error messages in the console?

It is doing this:

function trackOutboundLink(link, category, action) {
 
try {
dataLayer.push({'event':'interaction','eventCategory': category,'eventAction':action,'eventLabel': ''});
} catch(err){}
 
setTimeout(function() {
document.location.href = link.href;
}, 100);
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.