Public Methods
Public methods are SDK methods that are made available to facilitate your interactions with our SDK, including getting information from the widget configuration and from the current user consent state.
DidomiWidgets.getContainerById(widgetId)
The SDK allows you to get the configuration object of a published widget using the getContainerbyId
method.
We recommend getting the widget's configuration once the SDK is ready. You can refer to the example here.
DidomiWidgets.updateToken(token)
The SDK allows you to set the user token asynchronously.
container.getEntities()
The SDK provides a method called getEntities that enables you to retrieve entities from your Configuration Tree that are enabled in your widget. From there, you will be able to display purpose and preference choices on your page using our Custom Elements.
You will receive the following data. We recommend getting the widget's configuration once the SDK is ready. You can refer to the example here.
container.isConsentPurposeEnabled(purposeId)
The SDK provides a method for checking whether a purpose is enabled or not.
The method, isConsentPurposeEnabled(purposeId)
takes the purpose ID as a parameter and returns true
or false
.
container.getPreferenceValueById({ purposeId, preferenceId })
The SDK provides a method for fetching choices selected from a preference.
The method getPreferenceValueById
takes the purpose ID and preference ID as parameters and returns a string of IDs separated by commas (,
) containing the enabled values.
container.getEntityContentById({ entityType, entityId, entityProperty, withComponentContent })
The SDK offers a method for displaying the translated content of your entities if you are unable to use our custom elements.
The method getEntityContentById
takes the entityType, entityId, entityProperty and withComponentContent as parameters and returns a string with the content requested.
Parameter | Description |
---|---|
| This property determines which content of the entity object should be displayed. It can be |
| ID of the selected purpose, selected preference or preference value. You can easily find them in the Configuration Tree section on the Console. |
| Specify the type of property. It can be either |
| This property is used to determine whether to override the entity content with the layout component one set a widget level, if any ( |
container.getComponentContentById({ componentId, componentProperty })
The SDK offers a method for displaying the translated content of your component if you are unable to use our custom elements.
The method getComponentContentById
takes the containerId, componentId and componentCategory as parameters and returns a string with the content requested.
Parameter | Description |
---|---|
componentId | ID of the layout-component |
componentProperty | Property of the layout-component. For example |
Last updated