Highlighted

Target/Personalize user to prompt message before browser close

Prarthana_Sharm

28-12-2017

Hi,

I am trying to see if there is a way to prompt message before browser close utilizing adobe target?

Please let me know if I can see some examples or ideas?

Replies

Highlighted

LJ_Jones

03-01-2018

There isn't a built in way in Target to do this, but you can do it through jquery.  I prefer a method that doesn't block the user from closing the browser window.  While you could try and tie the popup directly to the click to close the window, this is spammy and not a good practice.

What I recommend is using the jquery mouseleave function.  What this function does is detect when the user's mouse has left the browser window.  We are making the assumption that they have left the window because they are about to close it.  Its not perfect, but it does work well.  And it doesn't block the user from closing the window.  Its worth noting that it only works on Desktop because you can't detect the mouse movement on mobile.

I have used this before and have seen an increase in revenue when used with a good offer.  You can see the offer I used in the exit pop and read more about the success we had here.

Exit Pops that Generate Revenue

Here is some simple jquery that I have used to detect the mouse out and show a div with the exit pop content.

$(document).mouseleave(function () {

    //your action code goes here

$( "#exitPop" ).show();

$( "#exitPopBackground" ).show();

});

LJ_Jones

04-01-2018

One correction I wanted to add to my code.  You don't want the exit pop to pop up over and over again.  So I added a variable so that it only pops once.

Here is the updated code.

var mouseOut = 0;

$(document).mouseleave(function () {

  if(mouseOut==0){

  //your action code goes here

  $( "#exitPop" ).show();

  $( "#exitPopBackground" ).show();

  mouseOut = 1;

  }

});

Highlighted

Prarthana_Sharm

05-01-2018

Thank you. I need to try this first and get back to you.

But how should i try this on a targeted page versus the regular page? Within target, can I add addition jQuery?

Highlighted

LJ_Jones

08-01-2018

I use a lot of jquery in my tests.  In fact, most of my tests require jquery in order to test out the things I want to do.  I find it hard to tests things that will cause a significant lift if I am just changing simple things through images or html.

I am not sure what you mean by a targeted page and a regular page.  Could you explain more?