Strivacity SDK for JavaScript based Applications with TypeScript support.
Create an StrivacityClient
instance before rendering or initializing your application. You should only have one instance of the client.
Import as UMD
<head>
<script src="../dist/index.umd.js"></script>
</head>
<script>
(async function() {
const client = await createStrivacityClient({
timeout: 50000,
url: <STRIVACITY-URL>,
});
})();
</script>
Import as ESM
<body>
<script type="module">
import { StrivacityClient } from '../dist/index.esm.js';
const client = new StrivacityClient({
timeout: 50000,
url: <STRIVACITY-URL>,
});
</script>
</body>
Create an anonymous identity and return as a Promise.
Auth required: No
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
body | Attribute | Attribute | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
Example body (Attribute)
{
"attributes": {
"familyName": "string",
"givenName": "string",
"email": "string"
}
}
Success Response
{
"id": "string",
"createdAt": "string",
"attributes": {
"familyName": "string",
"givenName": "string",
"email": "string"
}
}
const attributes = {
attributes: {
familyName: "Snow",
givenName: "John",
email: "[email protected]"
}
};
client.anonymousIdentity.createIdentity(attributes)
.then((response) => console.log('success', response))
.catch((error) => console.log('error', error));
Check an anonymous identity and return as a Promise.
Auth required: No
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
id | ID of anonymous identity | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
Get an anonymous identity and return as a Promise.
Auth required: Yes
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
id | ID of anonymous identity | string | - | Yes |
session | Session | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
client.anonymousIdentity.getIdentityById('testId', 'session')
.then((response) => console.log('success', response))
.catch((error) => console.log('error', error));
Delete an anonymous identity and return as a Promise.
Auth required: No
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
id | ID of anonymous identity | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
Get all consents of an anonymous identity and return as a Promise.
Auth required: Yes
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
identityId | ID of anonymous identity | string | - | Yes |
session | Session | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
client.anonymousIdentity.consent.getConsents('testId', 'session')
.then((response) => console.log('success', response))
.catch((error) => console.log('error', error));
Create a consent of an anonymous identity and return as a Promise.
Auth required: No
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
identityId | ID of anonymous identity | string | - | Yes |
body | Attribute | Attribute | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
Example body (Attribute)
{
"format": "iab",
"iab": {
"receipt": "string"
}
}
Success Response
{
"id": "string",
"createdAt": "string",
"format": "iab",
"iab": {
"receipt": "string"
}
}
Check a consent of an anonymous identity and return as a Promise.
Auth required: No
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
identityId | ID of anonymous identity | string | - | Yes |
id | ID of consent | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
Get a consent of an anonymous identity and return as a Promise.
Auth required: Yes
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
identityId | ID of anonymous identity | string | - | Yes |
id | ID of consent | string | - | Yes |
session | Session | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
Delete a consent of an anonymous identity and return as a Promise.
Auth required: No
Parameters
Name | Description | Type | Default Value | Required |
---|---|---|---|---|
identityId | ID of anonymous identity | string | - | Yes |
id | ID of consent | string | - | Yes |
options | Fetch API options | RequestInit | {} |
|
timeout | Overwrite the default timeout | number | 30000 |
This project is licensed under the MIT license. See the LICENSE file for more info.