With the Leaving Notice addon for WP Popups, you can create a popup that displays when a user clicks an external link on your site. This lets visitors know that they’re going to be leaving your site and gives them a chance to remain on your site if they don’t want to leave.
You can either trigger your popup for all external links. Or, you can target just a specific class of links.
How to Create a Leaving Notice Popup
To get started, make sure to install the Leaving Notice addon, which you can download from your WP Popups Downloads dashboard.
1. Create a New Popup and Select Leaving Notice Template
In your WordPress dashboard, go to WP Popups -> Add New to create a new popup.
In the Setup tab, select the Leaving Notice template:
2. Configure Leaving Notice Functionality
To configure how your leaving notice popup functions, go to the Addons tab in the template builder and select Leaving Notice.
There, you’ll see three settings in the interface:
- Enable – whether or not to enable the leaving notice.
- Automatically redirect user to destination after – how many seconds to wait before automatically redirecting a visitor to the external link (even if they don’t click a button). If you don’t want to enable automatic redirection, you can set the value to “0” to disable automatic redirection.
- External Links – if you check the box, your leaving notice will display on all external link clicks on your site. If you uncheck the box, you can target specific attribute classes so that your leaving notice only appears on links with specific attribute classes.
Also, if you need to display the link clicked in the popup you can use the shortcode [wppopups-final-url] and it will be replaced by the URL of the clicked element.
3. Configure Text and Styling
To customize the text and styling for your leaving notice popup, you can use the Content and Appearance tabs in the WP Popups template builder.
You can change the:
- Warning text
- Button text to leave your site or stay on your site
- Display location
For example, to change the text of the buttons, you can open the Appearance tab and configure the Leaving Notice Addon settings:
4. Publish Popup
Once you publish your popup, your leaving notice will be live for either all or some of your external links, depending on how you configured the plugin in Step #2.
How to disable “leaving notice” on certain links?
If you want to disable the popup for certain external links you will need to add “spu-leaving-off” class attribute to those links like this:
<a href=”external_link.com” class=”spu-leaving-off”>External link</a>