Layout / Tree

What is an entities tree?

The purpose of the tree is to link the purposes, preferences and channels previously created in the entities section together as a tree structure.

Structure

Each tree needs to follow the same structure. You can only have one tree per container.

Purposes

A purpose is always connected to a container as a child. Each purpose has an attribute id set in the entities array, a channels and a preferences attribute. Those attributes contain an array of preferences and channels.

Preferences

A preference is always linked to a purpose as a child. Each preference has an attribute id set in the entities array and channels. The channels attribute contains an array of channels.

Channel‌s

A channel can be linked to a preference as a child, a purpose as a child or directly at root level (like the purpose). Each channel has an attribute id set in the entities array.

Where do I add my entities tree?

Once you know the structure you want for your consents, you can add it to your configuration. A tree object needs to be added in the layout object of the entities object:

window.didomiConfig = {
containers: [
{
id: "CONTAINER_1_ID",
entities: {
activeEntities: [...], // We created 4 entities here
layout: {
purposes: [
{
id: "PURPOSE_1_ID",
preferences: [
{
id: "PREFERENCE_1_ID",
channels: [
{
id: "CHANNEL_1_ID"
},
{
id: "CHANNEL_2_ID"
}
]
}
]
}
}
}
}
]
]
};

Example

In the case where you have :

Two purposes:

  • analytics

  • social_media

Each purpose contains the same preference:

  • commercial_communication

For analytics => commercial_communication , we want to display 3 channels

  • email

  • text

  • call

For social_media => commercial_communication , we want to display only one channel

  • email

The tree would be :

window.didomiConfig = {
...,
entities: {
activeEntities: [...], // We created entities here
layout: {
purposes: [
{
id: "analytics",
preferences: [
{
id: "commercial_communication",
channels: [
{
id: "email"
},
{
id: "text"
},
{
id: "call"
}
]
}
]
},
{
id: "social_media",
preferences: [
{
id: "commercial_communication",
channels: [
{
id: "email"
}
]
}
]
}
]
}
}
};

Now that we have our entities ready, let's start creating our visual components.