Prerequisites
- Castled CEP account is already setup
- Make sure you have conset from from the user before sending user attributes or events to Castled.
SDK Initialization
You can use one of the following approaches to add SDK to your websiteAdd SDK as a code snippet
To integrate the JavaScript SDK with your website, place the following code snippet in the<head> section of your website.
- Minified code
- Non-minified code
APP-ID is a unique id associated with your Castled workspace. It can be found in the Castled dashboard at Settings > Api Keys.
Install using npm package manager
you can also use this NPM module to package the library directly into your project. To install the SDK via npm, run the following command:Since the module exports the related APIs on an
already-defined object combined with the Node.js module caching, you should
run the following code snippet only once and use the exported object
throughout your project:
require method, as shown:
Exported APIs
The APIs exported by the module are:loadreadyidentifytrack
Supported browser versions
| Browser | Supported Versions |
|---|---|
| Safari | v7 or later |
| IE | v10 or later |
| Edge | v15 or later |
| Mozilla Firefox | v40 or later |
| Chrome | v37 or later |
| Opera | v23 or later |
| Yandex | v14.12 or later |
If the SDK does not work on the browser versions that you are targeting, verify if adding the browser polyfills to your application solves the issue.