Utility functions

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Altocloud Developer's Guide for version Current of Altocloud.

Utility functions simplify certain operations and calls to the Altocloud SDK collection methods.

About utility functions

Altocloud provides several utility functions to simplify certain operations or calls to the Altocloud SDK collection methods. For more information, see Collect tracking data in Web Tracking API.


The serialize method creates a JSON object where the keys are the form elements names, and the value for each key is the value(s) of the corresponding form elements. This method is useful in scenarios such as submitting a form with AJAX, since submit won’t be able to capture the form submission, but instead a record can be invoked passing the serialized form data as its last argument. The serialize method takes the following parameters:

  • A unique identifier of the HTML form element
  • An (optional) array with the names of the elements to be serialized
  • A callback function with the serialized form data into a JSON object
ac('serialize', 'my-form', function(data) {

dom - ready

The ready method of the dom module allows you to specify a function handler to run when the DOM has fully loaded. A webpage cannot be altered safely until the document is ready, Altocloud’s SDK starts executing regardless of the DOM readiness, and may even fire events before that. Any code reacting to these events that need to modify the DOM should be placed inside the ready handler.

ac('dom', 'ready', function () {
  // safely modify the DOM here


To turn on debug mode, invoke the debug method. This mode logs helpful messages to the console.

This example shows how to enable debug mode


This example shows how to disable debug mode.

ac('debug', false);