Sub-domain cookies¶
The JavaScript library can create cookies that will persist between sub-domains via the optional argument domain
.
An example use case for this behavior is if a retailer's shop is located at the sub-domain www
and the checkout process is located under the sub-domain order
. Normally, the cookie would not exist at the sub-domain order
and the session would be broken.
Example¶
The example below will create an apptus.customerKey
cookie and an apptus.sessionKey
cookie, each with the domain .example.com
. Note that the prefixed dot (.
) in the domain in the cookie is added automatically by the browser.
var api = window.esalesAPI({
market: '{market}',
url: 'https://{cluster-id}.api.esales.apptus.cloud',
domain: 'example.com'
});
For more general cookie management information, see Cookies.