JavaScript library¶
The JavaScript library is built on top of the RESTful API and it is designed to make it easy to communicate with Elevate from a site both when fetching results and when notifying events.
API key and credentials¶
To be able to access and use the Elevate 3 Enterprise API the customer onboarding Prerequirements must be fulfilled.
Set-up¶
The first step to use the JavaScript library is to include the script in each HTML page communicating with Elevate in some way.
Check JavaScript library version
Always check the latest JavaScript library version.
<head>
...
<script type="text/javascript"
src="https://cdn.esales.apptus.com/api/apptus-esales-api-1.X.Y.js">
</script>
...
</head>
The JavaScript library exposes an esales
object which is the base to all interactions with the Elevate cluster in the HTML page. Once the script is included in the HTML page, the next step (and also a general recommendation) is to instantiate an esales
object by using the case sensitive Web API identifier for a cluster provided by Voyado and the market Elevate should use to fetch content and group notifications.
var esalesObj = window.apptus.esales("{cluster-id}", "{market}");
Once the esales
object is instantiated a session key and a customer key token are automatically generated (if not already present) and stored in cookies.
Sessions¶
A session starts with the first interaction of a visitor that results in a query or notification via the RESTful API. The visitor is automatically assigned a randomized session and customer key which is a UUID / GUID. A new customer key and token, generated by the Customer key authentication class, will be assigned to the visitor when the visitor signs in to the website.
A session ends when the visitor signs out and the end session notification is sent. The set cookies are cleared and a new randomized session customer key is generated.
The default level of personalisation for the JavaScript library is the Medium level of personalisation.