Applets

Introduction

Applets allow:

  • Provide operators with visitor information and context from external

    applications such as CRM.

  • Trigger actions in these applications.

  • Embed any other visualization and logic within the Glia Hub.

The purpose of applets is to reduce the manual work of operators. Since applets are built using regular web development languages (JavaScript, HTML), they are not limited to just pulling data into Glia Hub, any logic that increases the productivity of operators can be implemented.

Applet appears in the form of a tabbed panel during observation or engagement with visitor, just like Glia provided visitor information panel. They can be minimized or expanded by the operator as necessary.

Features

  • Developed using standard web development stack (JS, HTML) and embedded using

    an iframe.

  • Applet JS SDK is provided to access the Glia Hub context and listen events

    from applet code.

  • Installed via Glia Hub's Admin Console or REST API by uploading the code

    as HTML file

Getting Started on Using Applets

Applets are developed as any other web application, the Applet JS SDK script is included to make use of the Glia API for applets.

The applet below is querying the visitor's external_id custom attribute. Reference to the Glia API can be obtained using window.getGliaApi function which returns a promise that resolves upon establishing communication between the applet and Glia. The example below has one event listener listening to VISITOR_STATE events.

Example applet

<html>
<head>
<script type="text/javascript" src="//libs.glia.com/axon.js"></script>
</head>
<script>
function setExternalId(visitor) {
document.getElementById('visitor-external-id').innerHTML =
visitor.customAttributes.external_id || '-';
}
window.getGliaApi({version: 'v1'}).then(glia => {
glia.addBufferedEventListener(glia.EVENTS.VISITOR_STATE, setExternalId);
});
</script>
<body>
<p>Visitor External ID:</p>
<p id="visitor-external-id"></p>
</body>
</html>

Development Mode

In order to simplify the development and testing of applets, the reference to Glia API can be obtained in development mode. This enables the usage of the API without running the applet in the Glia Hub. In development mode, the API functions and events will return mock data. Currently, it is not possible to control the mock data that will be returned during the development mode.

To enable the development mode request the API with optional parameter of development: true.

window.getGliaApi({version: 'v1', development: true});

Installing an Applet

Once the applet code is ready, it can be added to the site via the Glia Hub by creating a new applet in Admin Console and uploading the source code. The same can be done using applet's management REST API.

Security Measures

The communication between an applet and Glia is secure in a way that makes it impossible for any other part of the site or any browser plugin to access sensitive information.