Custom elements
Custom events are synthetic events in Javascript that can be dispatched to our SDK.
Use custom events to communicate with our custom elements to wrap your code and handle all logic, analytics and API requests.
didomi-container-headless
Add the custom element didomi-container-headless
to wrap your widget. This component should wrap all other widget related elements as it contains a boundary intercepting events and communicating with our API.
id
ID of the widget
didomi-if-not-authenticated
To display content when the end-user is not logged into the Didomi system, add the custom element didomi-if-not-authenticated
.
container-id
ID of the widget
didomi-if-authenticated
To display content only when the end-user is logged into the Didomi system, add the custom element didomi-if-authenticated
.
container-id
ID of the widget
didomi-auth-headless
Add the custom element didomi-auth-headless
to wrap a login form and handle end-user authentication.
To request authentication, you will need to create and dispatch the custom event didomi:send-authentication
.
container-id
ID of the widget
This custom element takes care of sending the authentication.asked
and authentication.sent
analytic events.
didomi-consent-asked
To send consent.asked
analytics event, add the custom element didomi-consent-asked
.
Please make sure to only add this component once in your page to avoid sending multiple events.
container-id
ID of the widget
didomi-consent-receiver
To send end-users' choices through our SDK upon click, wrap your entities in the custom element didomi-consent-receiver
.
container-id
ID of the widget
To save end-users' choices through our SDK upon clicking, create and dispatch the custom event didomi:set-consents
.
This custom element takes care of sending the consent.given
analytic event.
didomi-pending-consent-receiver
To store end-users' choices in the application state before saving them, wrap your entities in the custom element didomi-pending-consent-receiver
, create and dispatch the custom event didomi:set-pending-consents
.
Within the didomi-pending-consent-receiver
, you will also need to add a save button, create and dispatch the custom event didomi:save-pending-consents
to save the consent state in our database.
container-id
ID of the widget
This custom element takes care of sending the consent.given
analytic event.
didomi-component-content
To display a content option of a component of your widget, use the custom element didomi-component-content
.
container-id
ID of the widget
component-id
ID of the layout-component
component-property
Property of the layout-component. For example saveButton.text.content
(if it has been edited at the layout-component level) or icon.src
to get the URL of the preference value.
didomi-entity-content
To display an entity of your widget, such as the title or description from a purpose or preference, use the custom element didomi-component-content
.
container-id
ID of the widget
entity-id
ID of the selected purpose, selected preference or preference value. You can easily find them in the Configuration Tree section on the Console.
entity-property
This property determines which content of the entity object should be displayed. It can be name
or description
.
entity-type
Specify the type of property. It can be either purpose
, preference
or preference-value
.
with-component-content
This property is used to determine whether to override the entity content with the layout component one set a widget level, if any (true
), or to display the entity content (undefined
).
Last updated