How to add an EXIT POP-UP on GreatPages
To add an Exit Pop-up to a page on GreatPages, follow the tutorial below:
- Log in to your account and go to the page editor;
- Using the icons bar located on the left side of your screen, click on the "Adicionar Botão" option;

- Once the button element has been inserted into the page, click on "Editar";

- In the menu that opens, click on "Adicionar link" and select the "Abrir uma caixa (Pop-up)" option;

- With the pop-up element inserted into the page, use the left side menu of the screen to edit and customize it however you want;

- Next we will need to find the ID of this element in order to move on to the next step of creating the exit pop-up. To do this, click on the button again, go to "Editar" and, in the "Código" tab, click to copy the element's CSS selector

- After that, click on the "gear icon" in the top right corner of the screen;

- Then click on "Javascript & CSS";

- Click to "Adicionar" a new code;

- Choose a name for your code, select the "Funcionamento" option and add all the code below into the text field;
<script>
const botaoPopUp = $('#e_1074261_1_87957 .c');
/* se você deseja que o botão apareça na página remova a linha abaixo */
botaoPopUp.css({ 'visibility': 'hidden' });
/* Pegando o movimento do mouse */
$(document).on('mouseleave', function (e) {
console.log('Saiu da tela');
console.log('Tem popup aberto? ' + $('.gpc_modal-fundo').length);
console.log('Tem cookie gpages_popup_leave? ' + document.cookie.indexOf('gpages_popup_leave'));
/* Verificando se saiu da tela e não tem popup aberto */
if (!$('.gpc_modal-fundo').length) {
/* Gerando cookie */
var data = (new Date), data_limite = (new Date);
data_limite.setTime(data_limite.getTime() + (180 * 24 * 60 * 60 * 1000));
document.cookie = "gpages_popup_leave=" + data.getFullYear() + '-' + (data.getMonth() + 1) + '-' + data.getDate() + 'T' + data.getHours() + ':' + data.getMinutes() + ':' + data.getSeconds() + "; Expires=" + data_limite.toGMTString() + "; Path=/;";
/* Clicando no botão */
$(botaoPopUp).trigger('click');
}
});
</script>
- Take the ID of the pop-up element identified earlier and paste it exactly in the space of the code where it says -> '#e_0000000'

- To find out whether the code is working correctly, click on "Pré-visualizar" and move your mouse toward closing the page.
As soon as you make this movement, the pop-up will be triggered.

Still have questions? Reach out to our team on Chat! We're always happy to help.
Updated on: 08/01/2026
Thank you!
