You can facilitate JavaScript “window.onmessage” method to send events from tabs, popups and iframes.
Set up a listener on your site
You will need to add a listener for those messages on your site:
window.onmessage = function (e) { var event = e.split('|'); if (e[0]==='uDash'){ try { uDash[e[1]](e[2],e[3]); }catch(e){ uDash.saveMeta('Error','onmessage communication failed'); } }; };
Track events from a window opened by your site
To track data points from a popup or a tab use:
window.opener.postMessage('uDash|saveMeta|key|value', '*');
to save a meta event; or
window.opener.postMessage('uDash|saveAttribute|key|value', '*');
to save an attribute.
Please note that this will only work if popup or tab was opened by your site.
Track events from a window opened by your site
To save events from within an iframe, replace “window.opener” with “window.parent”:
window.parent.postMessage('uDash|saveAttribute|key|value', '*');