Article Category: JavaScript API


THIS FEATURE IS AVAILABLE ON PREMIER ACCOUNTS

Routing by Tag is an advanced feature which enables routing of chats to the most appropriate agent based on skill-set, language, speciality, etc. Setting up this feature requires configuration in the SnapEngage Admin Dashboard and possibly on the javascript of your website.

1. Enable the feature

This is done by signing into your …

Full Article →

Some users may want to hide the Chat Button initially, then reveal it after X seconds. Here is a little copy-and-paste Javascript snippet you can use to do this. This snippet utilizes the functions: SnapEngage.hideButton() and SnapEngage.showButton().…

Full Article →

In order to set up SnapEngage in a different language other than the one defined in the Admin Dashboard, you will need to use the code found under the ‘Advanced‘ section of the ‘Get the Code‘ tab.

* IMPORTANT NOTE: In order to use the .setLocale() Function, you must go to your “Style” tab, and under …

Full Article →

You have the option to not load SnapEngage on mobile browser pages, if you don’t want to display the chat there.

To do that, you would wrap the your SnapEngage code in a JavaScript “if” statement checking if the visitor is on a mobile browser:

if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|Android|IEMobile)/)) {

}

This is how the code block would look on your website:…

Full Article →

Awesome proactive chat engagement is something that we pride ourselves in here at SnapEngage.  However, when we implemented the proactive chat feature, we went off the assumption that if a visitor wasn’t called to action within a minute or two, they probably weren’t interested in initiating a chat, and consequently, we programmed the proactive chat window to automatically disappear.  We …

Full Article →

You can pre-populate the “Your question” field in the Pre-Chat Form. The message will still be fully configurable by your Visitor.

To pre-populate this field you can add the following code to your widget code where it says, “// Place your SnapEngage JS API code below”:

SnapEngage.setDescription('I would like to know about your awesome product...');

 

preset description

Full Article →

You can gather additional information with our JavaScript variable instrumentation and some JS scripting on your server.

The way it works is that, in the dashboard ‘Options’ tab ->’ JavaScript variable’ you setup the variable you want SnapEngage to instrument and capture when a chat starts. These can be global scope variables, or specific object methods you want SnapEngage to …

Full Article →

You will have to setup a rule (or some rules) that matches the URLs for these pages and therefore have a proactive chat message prompt defined. The delay should be long enough such as the engagement is not done by the timer but by the API call.

Just make this call from your JavaScript logic to start a proactive chat …

Full Article →

You can programmatically send text to the agent when a chat is in progress by calling the following API function:

SnapABug.sendTextToChat('Added a pink pony to shopping cart');

If this function is called when no chat is in progress, the call is ignored.…

Full Article →

Add a call to the following SnapEngage API function whenever you would like the cookies to be deleted.

SnapEngage.clearAllCookies();

Example

You might have a simple Sign Out link that runs a function from the <a onclick="" event.

<a href="#" onclick="exampleSignOut()">Sign Out</a>

Then you would just add the above-mentioned function into your exampleSignOut() function.

function exampleSignOut() {
    ...
    SnapEngage.clearAllCookies();
    ...
}

Full Article →

To allow multiple widgets on the same page, we assume you already have one widgets JavaScript code from the Get The Code tab installed on your website (if you are using the Proactive Chat mode then install the widget code of this one).

Because the floating chat button on the border of the page can only be connected to one …

Full Article →

Overview

There are a few ways to start a chat with our Javascript API after you have the SnapEngage code installed on your website. Your usage may depend on exactly what you’re hoping to do, but in most cases we recommend using the following.

SnapEngage.openProactiveChat();

You can make this call from a JavaScript function, or hook it onto the “onclick” …

Full Article →

Love coding and want to get your Agents status with an API? Well, you are in luck!

See the Javascript API Doc for .getAgentStatusAsync() here.

Here is how it works:

You can call this new API with an anonymous function as an argument. That anonymous function takes a boolean argument (online, in the example below) which will evaluate …

Full Article →

To disable proactive chat for converted visitors you should place the following line in the SnapEngage JavaScript code after the line:

// Place your SnapEngage JS API code below

SnapEngage.allowProactiveChat(false);

Note: If you have not added or updated your code since January 1st, 2013 then you will want to add the above line after the SnapEngage.addButton(…) or SnapEngage.init(…).

Full Article →

To fix the position of your chat box, just add a call to:

SnapABug.setFormTopPosition(40);

in the SnapEngage JavaScript section where 40 should be replaced by the distance in pixel from the top of the page. Fixing the position of the SnapEngage dialog from the top of the page is especially useful when your web application is rendered inside an iFrame,

Full Article →

In addition to copying the SnapEngage code to the page, you can add an onclick attribute to any HTML tag to open the SnapEngage window when a click on this element is performed.

onclick="SnapEngage.startLink();"

If you want to make a link in your content open SnapEngage, here is an example of how you could do that:

<a href="#" onclick="SnapEngage.startLink();">Chat with 

Full Article →

*Note: Please see the updated Javascript Event Documentation here.


List of Events:

Open:
usage: called when the user opens the form on a button click, through an API call to startLink(), startChat(), etc.
parameters:
– agent online/offline with the string value ‘online’ or ‘offline’

OpenProactive: 
usage: called when the proactive chat starts
parameters:
– agent

Full Article →

Overview

You can track your SnapEngage live chat events in Google Analytics. To get started, please use the guide and samples below as a reference.

NOTE: Before getting started, you will want to review the Javascript event API that is available from SnapEngage. You can find that in our developer section of the site, or directly here: http://developer.snapengage.com/javascript-api/


Setup Your

Full Article →

Have returning visitors or customers coming to your site frequently? You can pre-set the email address of known users using our JavaScript API. This will permit you to pre-populate the email field on a pre-chat form or if you are not using that, it will pass the email address of the visitor on to the agent at the start of …

Full Article →