I am using the following code to open a popup window that leads to an intent. However i can only track the event when the window closes. Is there a way at the momemt to track when a user presses the “Tweet” Button?
I read there was a postMessage event that is no longer working?
function TweetPopUp() {
$(".twitter-share-link").on("click", function(e){
e.preventDefault();
intent = $(this).attr("href"); // pre-built link of web intent
var win = window.open(intent, 'twitter','width=1000,height=420,status=0,toolbar=0');
var timer = setInterval(function() {
if(win.closed) {
clearInterval(timer);
alert('closed');
}
}, 1000);
});
}