Exit Intent Popup JavaScript for Webflow - A simple tutorial

Table of content

Did you ever inquire or purchase the item after seeing the popup on website?

It is called exit intent popup.

It would be best if you considered this marketing tactic to improve your website conversions as a website owner or business owner.

Today, I will show you how you can create a powerful exit intent popup javascript for any webflow website. In this exit intent popup tutorial you can simply copy and paste the JavaScript code into your Webflow website. This JavaScript can be used in any website be it WordPress, Wix, or any other static or dynamic website.

Let's learn step by step how to do webflow development and website platform development for exit intent popup.

Create Popup in your project

You can create a simple popup design in Webflow similar to below. I won't go into too much detail as I am assuming you already know how to create it in Webflow.

For those who are not using Webflow, you can create a popup in your platform or use HTML code below to create one.

<div class="exit-popup-modal">
<div class="exit-popup-wrapper">
<h2 class="heading">Heading</h2><a href="#" class="exit-popup-close">X</a>
<p class="paragraph ep-paragraph">Subheading</p>
<a href="#" class="exit-popup-btn">Book a Call</a>

All exit popup content will go inside the .exit-popup-modal container. It will have a black transparent overlay.
The .exit-popup-wrapper will have the actual content.

To make it work as a popup, you will also need some CSS.

Design your Exit Intent Popup For Webflow

You can design your popup in Webflow using CSS settings of each elements. Use your design sense to make your exit popup look prominent for your audience. So, let's xplore the intricacies of Webflow modal popups and learn how to customize them to align with your brand.

For those, who are not using Webflow, you can use below CSS to design it. I am providing basic CSS to make it look like popup, you can use images or different colors to make it look good.

.exit-popup-modal {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    border-radius: 0;
    background-color: rgba(0,0,0,.7);
    text-align: left;
 .exit-popup-wrapper {
    position: relative;
    top: 10%;
    bottom: 10%;
    display: block;
    width: 100%;
    max-width: 720px;
    margin-right: auto;
    margin-left: auto;
    padding: 40px;
    background-color: #f6f9ff;

As you can see, I've added a z-index to make sure it appears on top of every other elements on the page.

Write JavaScript to make Exit popup work

Now let's add a JavaScript and determine how to show the exit intent popup javascript.

We want to detect if the user moves their mouse cursor out of the window. And then we have to use cookie to determine that popup won't show all the time mouse cursor moves out of the window.

I have already written the whole exit intent JavaScript for you. You can simply copy and paste the JavaScript to your Webflow inside Custom Code section of Project Settings.

If you are using it on other platform, you can add this JavaScript in Footer section of your website. And please make sure that jQuery library is added to the site.

<script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
/*cookie function - Set and read cookie */
  function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		var expires = "; expires="+date.toGMTString();
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	return null;

/* Detecting mouse out event */
  document.addEventListener("DOMContentLoaded", () => {
  document.addEventListener("mouseout", (event) => {
    if (!event.toElement && !event.relatedTarget) {
      setTimeout(() => {
        var ifcookie = readCookie("exitpopup");
    	if(ifcookie !="hide"){
      }, 100);
/* Closing the popup and setting up cookie so it won't show it again.*/
$('.exit-popup-close').on('click', function(){
  createCookie("exitpopup","hide","7"); //You can set any number of days here.

So, that's webflow exit intent popup.
You have your exit intent popup ready using Javascript.

Also, Read: Strategies For Improve Website User Experience

Final Words

Now you know how to create step by step exit intent popup. Few things you must remember to make it more effective for your users.

Here's a simple checklist to get the most out of your exit intent popup.

  • Keep a meaning message so your user will stay interested.
  • Create urgency if possible.
  • Give something for free and grab an email Id.
  • Focus on user experience and catchy design to make them stay.

Congratulations! You've successfully implemented an effective webflow exit-intent popup using JavaScript. By tailoring the tutorial to your Webflow website, you've not only reduced bounce rates but also enhanced user engagement across different platforms.

I hope you learned something today.

Happy coding!

Also, Read: Top 10 Best Webflow Apps & Integrations for your site


1) What is an exit intent popup, and how does it engage website visitors?

An exit intent popup is a strategic element that appears when a user is about to leave a website. It captures attention and can present offers, encouraging visitors to stay longer or take specific actions.

2) Why is an exit intent popup beneficial for website conversion, and what are its primary advantages?

Exit intent popups can significantly reduce bounce rates by re-engaging visitors before they leave. They offer an opportunity to present special offers, collect email addresses, or provide relevant information, ultimately boosting conversions.

3) How can I implement exit intent popups on my Webflow site using JavaScript, and is it a complex process?

Implementing exit intent popups on a Webflow site involves adding custom JavaScript code. While it may seem technical, the process is explained in the blog post and can be achieved with step-by-step instructions.

4) Are exit intent popups customizable, and can I design them to match my website's branding and style?

Yes, exit intent popups are highly customizable. Webflow allows users to design popups that align with their brand, incorporating custom styles, colors, and messaging for a seamless integration with the website.

5) Can I track the performance of exit intent popups, and are there analytics tools available for monitoring user interactions?

Webflow provides analytics tools that allow users to track the performance of exit intent popups. These tools offer insights into user interactions, conversion rates, and the overall effectiveness of the exit intent strategy.

6) Do exit intent popups work well on mobile devices, and what considerations should I keep in mind for a mobile-friendly experience?

Exit intent popups can be optimized for mobile devices. The blog post likely provides guidance on ensuring a responsive design, allowing users on smartphones and tablets to have a positive interaction with the exit intent popup.

Viken Patel

Viken Patel

Viken Patel has 14+ years of experience working with websites. He is passionate about building website that converts. His marketing background helps him build the sales driven websites.

5 Pop-Up Ideas To Optimize Your Website

5 Pop-Up Ideas To Optimize Your Website

Discover effective pop-up ideas & website pop-up design tips to boost engagement & conversions. Learn how to create attention-grabbing & impactful pop-ups.

Webflow SEO: A Beginner’s Guide to Win Over the Search Engines

Webflow SEO: A Beginner’s Guide to Win Over the Search Engines

Webflow is a responsive website builder that's emerged as an indispensable tool for businesses and individuals alike. Its responsive design, intuitive interface, and robust features provide a comprehensive solution for creating stunning websites without the need for complex coding.

Why Webflow Is the Best SaaS Website Builder

Why Webflow Is the Best SaaS Website Builder

In the competitive landscape of Software as a Service (SaaS), having an impactful online presence is crucial. This is where Webflow comes into the picture as a game-changer for SaaS companies.

Hire a Webflow Expert for your webflow website

Quick Turnaround. No Contracts. Cancel Anytime. Book a 30 minutes consulting call with our expert.
Book a Call