Skip to content

API Reference

getCategories()

  • Description: Returns the consent categories defined in the project's configuration.
  • Returns: The consent categories defined in the project's configuration.

Example:

javascript
const categories = sdk.getCategories();

getProjectConfig()

  • Description: Returns the project's configuration, fetched from the API.
  • Returns: The project configuration returned from the API.

Example:

javascript
const projectConfig = sdk.getProjectConfig();

updateGuiOptions(guiOptions: SDKGuiOptions)

  • Description: Updates the GUI options for the consent management platform.
  • Parameters: guiOptions (SDKGuiOptions) - The new GUI options to apply.
  • No return value.

Example:

javascript
sdk.updateGuiOptions({
  consentModal: {
    layout: "box",
    position: "top center",
  },
});

updateCredentials(credentials: SDKCredentials)

  • Description: Updates the SDK credentials.
  • Parameters: credentials (SDKCredentials) - The new credentials.
  • No return value.

Example:

javascript
sdk.updateCredentials({
  url: "https://new-api-url.com",
  key: "new-api-key",
  trackingId: "new-tracking-id",
});

checkUserConsent()

  • Description: Checks the user's consent status.
  • Returns: A Promise that resolves with the user's consent status, or null if no consent data is found.

Example:

javascript
sdk.checkUserConsent().then((consentStatus) => {
  console.log(consentStatus); // Consent status or null
});

reset()

  • Description: Resets the SDK configuration.
  • Returns: This function has no return value.

Example:

javascript
sdk.reset();