Containers

What is a container?

The purpose of a container is to encapsulate all the data (entities, components, translations) we need to build a preference center.

Structure

Each containers need to follow the same structure. A container contains an ID, entities list and layout, components list and layout as well as translations. It also allows you to only have one Didomi Element in your HTML page and generate your entire preference center from the didomiConfig object.

Where do I add my containers?

A container object needs to be added in the containers array of the didomiConfig object and contains an ID to be configured properly:
1
window.didomiConfig = {
2
containers: [
3
{
4
id: "my-first-container"
5
components: {},
6
entities: {},
7
translations: []
8
}
9
]
10
};
11
// In your HTML, where you want to display the elements
12
<didomi-container id="my-first-container"></didomi-container>
Copied!
Feel free to rename my-first-container with something more personalized.
Now that we have the base of our structure, let's continue by creating our entities.
Last modified 11mo ago