• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

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.

window.onunload="";

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?
0
marchaberman
Asked:
marchaberman
  • 2
1 Solution
 
IsisagateCommented:
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 google.com 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..
0
 
IsisagateCommented:
oops

ary[x].onclick
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now