Search…

Search…

Embed Survey

How to implement an exit intent popup survey

How to implement an exit intent popup survey

Exit intent popups engage visitors who are about to leave your site. By triggering a survey popup when users show exit intent, you can gather feedback and retain visitors. Follow these steps to set it up:

  1. Get Your Popup Embed Code:

Navigate to your survey -> locate "Sharing" section -> select "Popup embed" -> click "copy Code".

  1. Add the JavaScript Snippet:

Once you have the embed code, you can add the following JavaScript snippet to your website. Please add this under your Popup embed code.

<script>
  let exitIntentDetected = false;

  window.addEventListener("mouseout", (event) => {
    if (!exitIntentDetected && event.clientY < 0 && event.relatedTarget === null) {
      const msBtn = document.querySelector('[id^="metasurvey-button"]');
      if (msBtn) {
        msBtn.click();
        exitIntentDetected = true; // Prevent multiple triggers
      }
    }
  });

  // Hide the button
  /*window.addEventListener("load", () => {
    const msBtn = document.querySelector('[id^="metasurvey-button"]');
    if (msBtn) {
      msBtn.style.display = "none";
    }
  });*/
</script>

You can also uncomment the following lines to hide the call-to-action button (remove /* at the beginning and */ at the end):

/*window.addEventListener("load", () => {
    const msBtn = document.querySelector('[id^="metasurvey-button"]');
    if (msBtn) {
      msBtn.style.display = "none";
    }
  });*/
  1. Test on Your Website:

Finally, test your website to ensure that the survey popup appears when you exhibit exit intent (try to close the browser tab).

Exit intent popups engage visitors who are about to leave your site. By triggering a survey popup when users show exit intent, you can gather feedback and retain visitors. Follow these steps to set it up:

  1. Get Your Popup Embed Code:

Navigate to your survey -> locate "Sharing" section -> select "Popup embed" -> click "copy Code".

  1. Add the JavaScript Snippet:

Once you have the embed code, you can add the following JavaScript snippet to your website. Please add this under your Popup embed code.

<script>
  let exitIntentDetected = false;

  window.addEventListener("mouseout", (event) => {
    if (!exitIntentDetected && event.clientY < 0 && event.relatedTarget === null) {
      const msBtn = document.querySelector('[id^="metasurvey-button"]');
      if (msBtn) {
        msBtn.click();
        exitIntentDetected = true; // Prevent multiple triggers
      }
    }
  });

  // Hide the button
  /*window.addEventListener("load", () => {
    const msBtn = document.querySelector('[id^="metasurvey-button"]');
    if (msBtn) {
      msBtn.style.display = "none";
    }
  });*/
</script>

You can also uncomment the following lines to hide the call-to-action button (remove /* at the beginning and */ at the end):

/*window.addEventListener("load", () => {
    const msBtn = document.querySelector('[id^="metasurvey-button"]');
    if (msBtn) {
      msBtn.style.display = "none";
    }
  });*/
  1. Test on Your Website:

Finally, test your website to ensure that the survey popup appears when you exhibit exit intent (try to close the browser tab).

Exit intent popups engage visitors who are about to leave your site. By triggering a survey popup when users show exit intent, you can gather feedback and retain visitors. Follow these steps to set it up:

  1. Get Your Popup Embed Code:

Navigate to your survey -> locate "Sharing" section -> select "Popup embed" -> click "copy Code".

  1. Add the JavaScript Snippet:

Once you have the embed code, you can add the following JavaScript snippet to your website. Please add this under your Popup embed code.

<script>
  let exitIntentDetected = false;

  window.addEventListener("mouseout", (event) => {
    if (!exitIntentDetected && event.clientY < 0 && event.relatedTarget === null) {
      const msBtn = document.querySelector('[id^="metasurvey-button"]');
      if (msBtn) {
        msBtn.click();
        exitIntentDetected = true; // Prevent multiple triggers
      }
    }
  });

  // Hide the button
  /*window.addEventListener("load", () => {
    const msBtn = document.querySelector('[id^="metasurvey-button"]');
    if (msBtn) {
      msBtn.style.display = "none";
    }
  });*/
</script>

You can also uncomment the following lines to hide the call-to-action button (remove /* at the beginning and */ at the end):

/*window.addEventListener("load", () => {
    const msBtn = document.querySelector('[id^="metasurvey-button"]');
    if (msBtn) {
      msBtn.style.display = "none";
    }
  });*/
  1. Test on Your Website:

Finally, test your website to ensure that the survey popup appears when you exhibit exit intent (try to close the browser tab).