Chat code for proactive chat

Posted on 2007-10-12
Last Modified: 2010-05-18
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?
Question by:marchaberman
    LVL 11

    Accepted Solution

    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..
    LVL 11

    Expert Comment


    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    E-commerce is quite a gambling world, and you should never entrust your business to a lucky chance. In order to outrun your competitors in a race to attract as many customers as possible, you need to have a well thought-out strategy under your belt.…
    Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery… provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now