Chat code for proactive chat

We have a code set up on one of the websites to have Pro-active chat. The aim is to catch customers who are going away from the shopping cart. The invitation is programmed to be displayed as a JavaScript alert box.

The invitation is working when the customer abandons the shopping cart, but it is also displayed when customers click on other buttons in the cart like Continue Shopping etc.

We thought of adding this code to all the buttons on the shopping cart and checkout process which are currently displaying invitations when they are clicked.


This will be added at the On Click Event of these buttons.

Is this the best solution or is there any better workaround for this issue?
Who is Participating?
So are you initiating this invitation in an "onunload" event?

If it's an on unload the only thing that really comes to mind is to add the checking to the buttons. Even then there is no perfect solution for your desired results especially if they are say typing in to the address bar and leaving.

Can you provide a little more detail on the current implementation... On an unload event you are poping up a new window?

You could probably bulk add the event at the bottom of the page with something like

var ary = document.getElementsByTagName("a");
for(var x=0; x<ary.length;x++)
ary.onclick = someFunctionToNegateThePopUp;

That might be an easier to manage solution...
**Note that you don't use () after the function because you are attaching the code to the onclick event not the return of the function..

Forced accept.

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.