Spotify Track Built-in Click Tracking

How to track clicks inside Spotify iFrame for embedded tracks? The best I have found so far is to use the solution below at this link: How to detect a click inside an iframe (cross-domain)? Aka Prevents 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 entire frame and sometimes works when the user clicks a tab. The idea is to know when the user clicks the link to the inline track so that we can track this with the FB pixel.

If there is no way to accurately track clicks on the cross-domain iFrames, is there a better solution in Spotify apis to help us track the interaction with the player?

+4
source

Source: https://habr.com/ru/post/1687346/


All Articles