Client API

Using the Arkose Client API

myArkose Object

The myArkose object that is provided when the Arkose Bot Manager API script (as installed in Client-Side Instructions) is loaded exposes a number of public functions that are listed below. Use these to help support specific your implementation requirements. One function that must ALWAYS be called is setConfig. This sets up the Client API e.g. callback functions.

MethodTypeDescription
myArkose.getConfigFunctionReturns the configuration object
myArkose.resetFunctionResets the current session for both detection and enforcement. This creates a new session.
myArkose.setConfigFunctionUpdates the configuration object.
myArkose.runFunctionTriggers the detection or enforcement API to classify the current session.
myArkose.versionStringReturns the API version (e.g. 2.0.0).

API Callbacks

The Client API provides callbacks that can be triggered during a session. These callbacks provide integration points that manage a user's journey based on your applications logic.

The following diagram and table show and specify the conditions that trigger a Client API callback. You need to write functions for what happens when each particular callback is triggered.

This diagram shows the API callbacks sequence, along with a brief description of what triggers each callback in that sequence position. Note that onShow and onHide can be triggered at two different sequence locations, and you must write their callback functions to handle both possibilities. Also note that a callback may not be triggered during a session. For example, if there are no internal Arkose API errors, onError is not be triggered.

Required Callbacks

Some callbacks are explicitly required for the Arkose Client API to function correctly.

Required Callbacks

Reason

onReady

The onReady callback is required to determine that the Arkose Client has finished loading on the page and is ready to be started.

When running inline mode, the game is automatically started when it is ready, therefore the callback is not specifically required.

When using lightbox mode, the callback must be listened to in order to know the game is ready to be triggered. This can be done either programatically by running myArkose.run, or by allowing the #selector configured in myArkose.setConfig to be triggered by the user.

onCompleted

The onCompleted callback will always be triggered when a challenged or suppressed session is completed. It includes the response.token which must be sent to the customer’s back end to verify a session is legitimate.

Other callbacks have functionality which can help control and observe the client-side flow, however are not explicitly required.

See Callbacks for more information about the specific callback functions.


What’s Next