Article Category: Javascript API


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().

(This function uses the Advanced Code Snippet and assumes you are using the Chat Button customized in your Configurator’s Style tab.)

Full Article →

In order to set up SnapEngage in a different language other than the one defined in the Configurator, 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 “Select your …

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:

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

The code above is …

Full Article →

Awesome proactive 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 know …

Full Article →

You can use the code in the Advanced section of the ‘Get the code’ tab in your configurator:

ADV JS

To preset the description you can add the following code to your widget code where it says, “// Place your SnapEngage JS API code below”:

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


Full Article →

The proactive chat minimum delay is set at 15 seconds. We impose this limit because it does not feel realistic to have the proactive chat prompting a visitor with an agent message before this delay.

If you really want to try that though, you can just implement a JavaScript timer calling our JavaScript API, like this:

You should place this …

Full Article →

To disable agent chat notifications for visitors browsing or reloading your website, navigate to your Style Settings.

In the Site Settings section, turn off “Show notifications to Agents when the Visitor browses or reloads pages on your site”

style_notification

Scroll to the top of the page and Click Save.…

Full Article →

Please note: this document is now considered obsolete.

If you have not updated your SnapEngage code since January 1st, 2013:
We highly recommend you update to the newer, better, faster, stronger version of the code by going to the “Get the code” tab in your Configurator, and replacing your old code with the new one.


 

This post provides the …

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 →

Please note: this document is now considered obsolete.

If you have not updated your SnapEngage code since January 1st, 2013:
We highly recommend you update to the newer, better, faster, stronger version of the code by going to the “Get the code” tab in your Configurator, and replacing your old code with the new one.


 

This short document provides …

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:

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.

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

Full Article →

To change the default position of the chat window add one of the following lines to the SnapEngage JavaScript advanced widget section of the code after the line:

//Place your SnapEngage JS API Code below

For top left positioning of the chat window:

For top right positioning of the chat window:

For bottom left positioning of the chat window:

For …

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 →

You can hide the screenshot option on the pre-chat dialog by adding the following call to the advanced code just after the line

// Place your SnapEngage JS API code below

(or if you have not updated your code since 1/1/2013 then just before SnapABug.addButton(…) or SnapABug.init(…) )

This call will remove the checkbox from the form, but will still allow …

Full Article →

You can have your chat communications encrypted with this setting in the Style tab of your widget settings:

If you are using the old JavaScript code method instead, you can update the SnapEngage code on your page or just add a call to:

in the SnapEngage JavaScript section. This call will force all the communications between the visitor and our

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 advanced widget code after the line:

// Place your SnapEngage JS API code below

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 SnapABug.addButton(…) or SnapABug.init(…).

Full Article →

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

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, on

Full Article →

You can activate this option in the “Style” tab of your widget settings.

When your visitor clicks a button to chat with you, you can skip the pre-chat form and go straight to the Live Chat instead by flipping this switch in your Configurator:

no-pre-chat

You also have the option to define your initial chat message here. For example, something like, …

Full Article →

To disable the screenshot feature use the SnapEngage JavaScript advanced widget code code from the get the code tab and after the line:

//Place your SnapEngage JS API Code below

add the code:

The screenshot option will no longer be displayed on the form, and the live support agent will not be allowed to request a remote screenshot while in …

Full Article →

You can deactivate the “Email us” button on your pre-chat form if your agents are available with this setting in the “Style” tab of your widget settings:

nueva

Don’t forget to click on “Save” after making the changes.

 

If you are using the old JavaScript code method instead, you can update the SnapEngage code on your page or just add …

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.

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

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 use the SnapEngage JavaScript event API to track various events with Google Analytics. You can track most of the events documented in the the Javascript Event API, which is available on our Developer API site. For the slightly different code to use with the new Universal Analytics please see the last code example below.


First, you’ll …

Full Article →

To continue a chat session across subdomains, just go to the Style tab of your Configurator and select ‘Enable chat session to continue across sub-domains of your site’.

subdomain

Be sure to enter your domain without the www. like: domain.com

If you are using the old JavaScript code method instead, you can update the SnapEngage code on your page or just …

Full Article →

You can pre-set the email address of known users with our JavaScript API.

To do this just add a call to:

SnapABug.setUserEmail('[email protected]');

in the SnapEngage JavaScript section where [email protected] should be replaced by your user email address.

The easiest way to set the email address would be from your server side scripting, but doing it from JavaScript is also possible.…

Full Article →