跟踪嵌入式Spotify跟踪点击

时间:2017-10-12 05:09:35

标签: javascript spotify

如何跟踪嵌入式曲目的Spotify iFrame中的点击次数?到目前为止,我发现的最好的是使用此链接中的以下解决方案: 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();
   }
}

此解决方案并不理想,因为它会跟踪整个框架内的点击次数,有时会在用户按Tab键时触发。我们的想法是知道用户何时点击我们的嵌入式跟踪链接,以便我们可以使用FB像素跟踪它。

如果无法准确跟踪跨域iFrame的点击次数,Spotify的apis中是否有更好的解决方案来帮助我们跟踪玩家互动?

0 个答案:

没有答案
相关问题