Jump to: navigation, search

Monitoring JavaScript

Introduction

The Monitoring JavaScript API is available through the JavaScript libraries provided by the Web Engagement Frontend Server at runtime (see Architecture for details.) By using this API in your web pages, you can submit events to the Genesys Web Engagement Frontend Server, independently from the set of events and conditions defined in the DSL files loaded by the browser's Monitoring Agents. The design model for the Monitoring JavaScript API is highly flexible, and its use can be extended well beyond the common model of user-triggered events—the design decision is up to you. You can submit UserInfo, SignIn, SignOut, and your own custom business events using this API.

Important
All methods and parameters are case sensitive.

API Entry Point

The entry point for this API is the global _gt (Genesys Tracker) object which implements a push() method to push events to the Frontend Server.

The gt.push() method takes into parameter a JSON array, which can contain any type of information and follows this syntax:

_gt.push(['<commandName>', { <parameter-1>: 'value-1', <parameter-2> : '<value-2>', ..., <parameter-n>: '<value-n>'}]);

where:

  • <commandName> is the name of the event command;
  • <parameter-i> is the name of a command parameter;
  • <value-i> is the value of a command parameter.

For instance, the following example shows how to use the event command to create a BUSINESS event and record a customer interaction with an Add To Cart link.

<a href="#" onClick="_gt.push(['event', { eventName: 'AddToCart', 
            productName : 'Sony', productModel: 'JVB72', 
            productPrice: '1000$'}]);">Add to Cart</a>

In this scenario, if the customer clicks on Add to Cart link, the _gt.push() method sends the AddToCart BUSINESS event to the Web Engagement Frontend Server. The event includes information about the product name, model, and price.

Possible Event Commands

sendUserInfo

Description: Sends a SYSTEM event including customer information. You should send this event only if the website has authenticated the user.

Parameters for the sendUserInfo command
Name Value Mandatory Description
userID string yes The identification ID or the user. For instance, the user account name or the e-mail address.
<customParameter> <customValue> no Any custom parameter containing user information.

Example with mandatory parameters only:

_gt.push(['sendUserInfo', {userID: 'user@genesyslab.com'}]);

Example with additional user information

_gt.push(['sendUserInfo', {userID: 'user@genesyslab.com', 
name: 'Bob',
sex: 'male',
age: 30}]);

sendSignIn

Description: Creates and sends the SignIn event. This SYSTEM event should be sent when the user authenticates.

Parameters for the sendSignIn command
Name Value Mandatory Description
userID string yes The identification ID or the user. For instance, the user account name or the e-mail address.
<customParameter> <customValue> no Any custom parameter containing the user information.

Example with mandatory parameters only:

_gt.push(['sendSignIn', {userID: 'user@genesyslab.com'}]);

Example with additional parameters:

_gt.push(['sendSignIn', {userID: 'user@genesyslab.com', 
name: 'Bob',
sex: 'male',
age: 30}]);

sendSignOut

Description: Creates and sends the SignOut event for the current user. This event should be sent if the user performs a logout on the website or as soon as possible after the logout action was done.

Parameters for the sendSignOut command
Name Value Mandatory Description
userID string no The identification ID or the user. For instance, the user account name or the e-mail address.

Note: Genesys recommends the use of this parameter even if it is not mandatory.

<customParameter> <customValue> no Any custom parameter containing user information.


Example with no parameter:

_gt.push(['sendSignOut']);

Example with additional parameters:

_gt.push(['sendSignOut', { userID: 'user@genesyslab.com'}]);

event

Description: Sends BUSINESS events to the server.

Parameters for the event command
Name Value Mandatory Description
eventName string yes The identification name of the event. This field is equivalent to the name parameter of the DSL <event> element.
<customParameter> <customValue> no Any custom parameter.


Example with mandatory parameters only:

_gt.push(['event', { eventName: 'SomeEvent'}]);

Example with additional parameters:

_gt.push(['event', { eventName: 'AddToCart',
productName : 'Sony',
productModel: 'JVB72',
productPrice: '1000$'}]);
This page was last edited on February 26, 2014, at 18:05.
Comments or questions about this documentation? Contact us for support!