Get your credentials From XGEN Admin Dashboard
The information needed to activate your API can be found in your Admin Dashboard
Log into your XGEN account and navigate to the bottom of the left side-menu. Select the Admin Dashboard page and find the following details:
Customer ID
TrackingID
App Key
App Secret
Contact Us For Account Credentials
Email [email protected]
Browser (manually via script tag)
<script src="/path/to/dist/sdk-core.umd.cjs"></script>
<script type="text/javascript">
const xg = new XGenClient({
//params
})
...
</script>
OR if you are using ES modules:
<script type="module">
import XGenClient from '/path/to/dist/sdk-core.js'
const xg = new XGenClient({
//params
})
...
</script>
In the above implementation options, you can also replace the /path/to/dist
with https://assets.xgen.dev/sdk-core/releases/latest
and then add /sdk-core.cjs
or /sdk-core.umd.js
as needed.
The client must be initialized with a key
, secret
, clientId
, and trackerId
for the SDK to function properly (instructions on where to find these lower on this page). These values should be passed when the DOMContentLoaded
event fires and should read:
const xg = new XGenClient({ key: '', secret: '', clientId: '', trackerId: ''});
Node.js (via npm)
npm install @xgenai/sdk-core --save
// Using ES modules (default)
import XGenClient from '@xgenai/sdk-core';
// OR if you are using CommonJS modules
const XGenClient = require('@xgenai/sdk-core')
For Node < 17 you'll need to load a fetch() polyfill. We recommend lquixada/cross-fetch:
// npm install cross-fetch --save
import 'cross-fetch/polyfill';