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:
1
window.didomiConfig = {
2
containers: [
3
{
4
id: "CONTAINER_1_ID",
5
entities: {
6
activeEntities: [...], // We created 4 entities here
7
layout: {
8
purposes: [
9
{
10
id: "PURPOSE_1_ID",
11
preferences: [
12
{
13
id: "PREFERENCE_1_ID",
14
channels: [
15
{
16
id: "CHANNEL_1_ID"
17
},
18
{
19
id: "CHANNEL_2_ID"
20
}
21
]
22
}
23
]
24
}
25
}
26
}
27
}
28
]
29
]
30
};
Copied!

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 :
1
window.didomiConfig = {
2
...,
3
entities: {
4
activeEntities: [...], // We created entities here
5
layout: {
6
purposes: [
7
{
8
id: "analytics",
9
preferences: [
10
{
11
id: "commercial_communication",
12
channels: [
13
{
14
id: "email"
15
},
16
{
17
id: "text"
18
},
19
{
20
id: "call"
21
}
22
]
23
}
24
]
25
},
26
{
27
id: "social_media",
28
preferences: [
29
{
30
id: "commercial_communication",
31
channels: [
32
{
33
id: "email"
34
}
35
]
36
}
37
]
38
}
39
]
40
}
41
}
42
};
43
Copied!
Now that we have our entities ready, let's start creating our visual components.
Last modified 1yr ago