Articles on: Page Editor

How to add an EXIT POP-UP on GreatPages

To add an Exit Pop-up to a page on GreatPages, follow the tutorial below:


The Exit Pop-up only works on the DESKTOP version (computer)


  1. Log in to your account and go to the page editor;
  2. Using the icons bar located on the left side of your screen, click on the "Adicionar Botão" option;



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



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



  1. 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;



  1. 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



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



  1. Then click on "Javascript & CSS";



  1. Click to "Adicionar" a new code;



  1. 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>


  1. 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'


Do not add any other characters or spaces. After that, click on "Salvar";



  1. 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

Was this article helpful?

Share your feedback

Cancel

Thank you!