Skip to content

JavaScript Library

The JavaScript library is built on top of the RESTful API and it is designed to make it easy to communicate with eSales from a site both when fetching results and when notifying events.

API key and credentials

To be able to access and use the eSales Enterprise API the customer on-boarding Pre-requirements must be fulfilled.

Set-up

The first step to use the JavaScript library is to include the script in each HTML page communicating with eSales 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 eSales 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 Apptus and the market eSales 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.

Detailed information

×
Copyright

This online publication is intellectual property of Apptus Technologies. Its contents can be duplicated in part or whole, provided that a copyright label is visibly located on each copy and the copy is used in conjunction with the product described within this document.

All information found in these documents has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither Apptus Technologies nor the authors shall be held liable for possible errors or the consequences thereof.

Software and hardware descriptions cited in these documents might be registered trademarks. All trade names are subject to copyright restrictions and may be registered trademarks. Apptus Technologies essentially adheres to the manufacturer’s spelling. Names of products and trademarks appearing in this document, with or without specific notation, are likewise subject to trademark and trade protection laws and may thus fall under copyright restrictions.

CLOSE