Trying to fire a custom facebook pixel event clicking to an external link (So I can track the analytics of customers going to an external link). I have a function that does work, and I have that attached to a normal link.
Works great on the normal website using
Was hoping there may be an overall method so that all link clicks will fire the event, and it's applied to all links after a delay (giving time for the popup to load.)
You can just listen for clicks on all buttons and
document.querySelectorAll("a, button").forEach(e => e.addEventListener("click", customEventHandler));
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.