Time-Delayed Popup
Here’s a short guide on how to automatically pop up a survey on your website after a specified time:
- Get Your Popup Embed Code:
Navigate to your survey -> click Share menu -> select Embed on website -> select Popup -> click Copy code.
- 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. Make sure to replace WAIT_SECONDS with desired time in seconds for the survey to appear.
<script>
const WAIT_SECONDS = 5;
window.addEventListener('load', () => {
const msBtn = document.querySelector('[id^="metasurvey-button"]');
if (msBtn) {
// msBtn.style.display = "none"; // Hide the button
setTimeout(() => msBtn.click(), WAIT_SECONDS * 1000);
}
});
</script>
You can also uncomment // msBtn.style.display = "none"; by removing the two slashes // at the beginning to hide the call-to-action button.
- Test on Your Website:
Finally, test your website to ensure that the survey popup appears after the specified time.