Cross-Frame Events
Send demo analytic events cross origin
You can now send Storylane demo analytics cross-frame to the hosting website. If you are embedding Storylane demo on your webpage, then real-time analytics events can now be subscribed on your webpage. Some use cases can be:
Launching chat window based on user action in the demo
Displaying demo-booking calendar based on user action
Combine Storylane analytics with additional user info and send to your analytics stack
Implementation
When Storylane demo is embedded on a webpage then each user interaction will trigger an event that will be sent through window.postMessage(). Below is an example of an event payload sent from Storylane demo iframe
//Storylane sends these postMessage events from iframe to the parent window
window.parent.postMessage(
{
message: 'storylane-demo-event',
payload: {
event: 'step_view';
demo: {
id: string;
url: string;
};
step: {
id: string;
index: number; // starts with 1
};
flow: {
id: string;
name: string;
};
}
},
'*'
)
You will subscribe to the above events like below on your webpage so it can be processed
Below are different event.data.payloadfor different analytic events sent from the Storylane Demo
Example of sending events to GA
Last updated
Was this helpful?