Containers

What is a container?

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

Structure

Each containers need to follow the same structure. A container contains a list of purposes.

Purposes

A purpose is always connected to a container as a child. Each purpose has an attribut id set in the entities array and preferences. The preferences attribut contains an array of preferences. If no preferences are linked to the purpose, you need to set an empty array [].

Preferences

A preference is always linked to a purpose as a child. Each preference has an attribut id set in the entities array and channels. The channels attribut contains an array of channels. If no channels are linked to the preference, you need to set an empty array [].

Channels

A channel is always linked to a preference as a child. Each channel has an attribut id set in the entities array.

Where do I add my containers?

Once you know the structure you want for your consents, you can add it to your containers. A container object needs to be added in the containers array of the didomiConfig object and contains a list of purposes to be configured properly:

window.didomiConfig = {
entities: [...], // We created 4 entities here
containers: [
{
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 list of containers would be :

window.didomiConfig = {
...,
entities: [...],
containers: [
{
purposes: [
{
id: "analytics",
preferences: [
{
id: "commercial_communication",
channels: [
{
id: "email"
},
{
id: "text"
},
{
id: "call"
}
]
}
]
},
{
id: "social_media",
preferences: [
{
id: "commercial_communication",
channels: [
{
id: "email"
}
]
}
]
}
]
}
]
};

To see how the entities list would look. Please visit this link.