How to track clicks within a Spotify iFrame for embedded tracks? The best I've found so far is to use the solution below from this link: How to detect a click inside of an iframe (cross-domain)? Aka prevent click fraud
var clickIframe = window.setInterval(checkFocus, 100);
var i = 0;
function checkFocus() {
if(document.activeElement == document.getElementById("element-id")) {
alert("dick don't break");
window.focus();
}
}
This solution is not ideal because it tracks clicks within the whole frame, and sometimes fires when the user presses tab. The idea is to know when a user clicks our embedded track link, so that we can track this with FB pixel.
If there is no way to accurately track clicks on cross domain iFrames, is there a better solution within Spotify's apis to help us track player interactions?