Help Center

Explore our knowledge base
article

Understanding the iAdvize Javascript code

The iAdvize solution can be installed in 5 minutes by adding a piece of code to your site. Here is a more detailed description of the asynchronous Javascript code used.

1/ The iAdvize Javascript code
2/ Long-polling
3/ Why iAdvize doesn't slow down my site

1/ The iAdvize Javascript code

1.1/ The code and its options

The iAdvize code is presented as follows:

<!-- START IADVIZE LIVECHAT -->
<script type='text/javascript'>
(function() {
var idz = document.createElement('script'); idz.type = 'text/javascript'; idz.async = true;
idz.src = document.location.protocol + "//XXXX.iadvize.com/iadvize.js?sid=YYYY";
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(idz, s);
})();
</script>
<!-- END IADVIZE LIVECHAT -->

The mandatory parameters are the following:

  • XXXX.iadvize.com: corresponds to the platform of your account. If your account is on the standard platform, you will get "lc.iadvize.com". If your account is on the high availability platform, you will get "halc.iadvize.com".
    This field is automatically filled in if you get the code from your iAdvize administration.
  • sid=YYYY: is the site identifier associated with your iAdvize account.
    This field is automatically filled in if you get the code from your iAdvize administration.

The optional parameters are the following:

  • &lang=ZZ: The language in which chat elements are displayed is the language of the visitor's browser by default. To force the display of chat elements in a given language, you can add the parameter &lang=ZZ after the parameter sid=YYYY.

Here is the list of languages ​​supported by iAdvize chat elements: fr (French) / en (English) / es (Spanish) / de (German) / nl (Dutch) / pt (Portuguese) / it (Italian) / pl (Polish) / tr (Turkish) / dk (Danish) / se (Swedish) / ca (Catalan) / ru (Russian) / cz (Czech) / cn (Chinese)

Here's an example of the iAdvize code once all the options are configured.


It is intended for a standard platform account with the website ID 1234 where the chat should be displayed in French regardless of the language defined in the visitor's browser.

<!-- START IADVIZE LIVECHAT -->
<script type='text/javascript'>
(function() {
var idz = document.createElement('script'); idz.type = 'text/javascript'; idz.async = true;
idz.src = document.location.protocol + "//lc.iadvize.com/iadvize.js?sid=1234&lang=fr";
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(idz, s);
})();
</script>
<!-- END IADVIZE LIVECHAT -->

1.2/ What you need to know about this code

  • It is very important that you do not modify its structure and that you keep all of the parameters defined in the initial code. It is also strongly recommended to avoid loading this code via another code or Javascript file.
  • This code should be installed on all of the pages of your site, ideally as close as possible to the html tag </body>, so that visitors chatting with an agent are not cut off when they change page.
  • This code is compatible with centralised Javascript tag manager solutions such as Google Tag Manager, Tag Commander, Tag Capsule etc.

 

2/ Long-polling

Long-polling is the method used by iAdvize to maintain an open connection between the visitor and the agent. It consists of the repeated sending of a script (HTTP-Bind) at regular intervals. The maximum interval between 2 script executions is 60 seconds.

In any kind of situation (chat or call ongoing or not), these requests are not "greedy" and only represent a download of less than 1 octet for each call.

Example of an iAdvize HTTP-Bind request:

 

3/ Why iAdvize doesn't slow down my site

The iAdvize code proposed is an asynchronous Javascript. In general terms, this means that iAdvize is loaded with time delays via a flow parallel to the overall loading of your website. It does not impair its loading.
This is also true if our servers crash - the loading of your site is not impacted if our asynchronous script does not respond.

Comments