UNPKG

measurement-framework

Version:

Collection of Javascript code to implement a browser based measurement system for websites. It uses a cookie to store a users action on a webpage and let you map thoose actions to a particular state in the user journey.

16 lines (14 loc) 456 B
import window from "window" import document from "document" import inIframe from "./helpers/inIframe" function postMessageSend(message) { /* check if we are in an iframe */ if (inIframe()) { message.iframeUrl = window.location.href message.iframeTitle = document.title window.parent.postMessage(JSON.stringify(message), "*") } else { /* here we could send some warning */ } } export default postMessageSend