🚢 Shipped

Communication between the embedded widget and your website

We added JavaScript events that can communicate with your website where the survey widget is embedded. When a survey is completed, the iframe will trigger an event that communicates the completion to your website.

You can use it in code to capture survey completion and send data to third-party tools such as SalesPanel: 

    /* Add SalesPanel source code here */

  window.addEventListener('message', event => {
    try {
      const message = event.data;
      if (message.type === 'ms-survey-completed') {
        const responses = message.data.responses;
        const res = responses.find((response) => response.question_id === "YOUR_QUESTION_ID");
        const customerEmail = res.value;
        $salespanel.push(["set", "identify:email", customerEmail, 'metasurvey']); // here we are sending the event data to SalesPanel
    } catch (error) {
      console.error('An error occurred in event ms-survey-completed:', error);

1 year ago

Kirill changed status to 🚢 Shipped

1 year ago

No votes yet