Created
August 31, 2015 23:58
-
-
Save recyclerobot/f056953f3e0749b2a942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Forward all postMessage calls from the iframes that have data in the form {method:, arguments:} directly to Segment. | |
window.onmessage = function(e){ | |
var method = e.data.method; | |
var args = e.data.arguments ? _.values(e.data.arguments) : null; | |
if (analytics[method]) { | |
analytics[method].apply(analytics, args); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment