> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/setup-and-monitor/plan-and-integrate/set-up-the-environment/set-up-compartments.md).

# Compartments

Keep accounts and profiles coming from different registration systems separate on the same user.

## Your goal

Declare one compartment per registration system that gives you user accounts or user profiles, so that a single user can carry an account and a profile from each of your systems without them overwriting one another.

## Expected outcome

Every registration system in scope has a compartment, and you know its ID - because a UserAccount identifier is only meaningful together with the compartment it belongs to.

## What a compartment is

A **compartment** represents a place where you have accounts and profiles. A UserPoint can have multiple user accounts and user profiles on the same datamart - for example a profile on one of your sites and another profile on another site - and compartments are the notion created to represent those different places.

Compartments matter when you aggregate data from different systems and want to keep [UserProfile and UserAccount](/setup-and-monitor/understand-mediarithmics/how-mediarithmics-works.md#information-attached-to-a-userpoint) data compartmented. If you have a website A and a website B, you can have a compartment for each; a single [UserPoint](/setup-and-monitor/understand-mediarithmics/how-mediarithmics-works.md#how-your-data-is-modelled-the-userpoint) can then carry a UserProfile and a UserAccount for website A, and a UserProfile and a UserAccount for website B.

Compartments are also part of the identifier itself: a **UserAccount ID** is composed of a character string and a compartment ID representing the registration system it came from. See [User Account](/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/user-identity/user-identifiers/user-account.md).

{% hint style="info" %}
There is always **one default compartment** on a datamart, and you can create more of them. A single-system integration can run on the default compartment alone.
{% endhint %}

Compartments appear in two places in the settings, because a compartment is **created on the organisation and then enabled per datamart**:

| Task                                                                  | Where                                      |
| --------------------------------------------------------------------- | ------------------------------------------ |
| Create a first-party compartment, or subscribe to a shared one        | **Settings > Organisation > Compartments** |
| Manage the compartments of a datamart, and enable a compartment on it | **Settings > Datamart > Compartments**     |

Compartments come in two categories:

* **First-party user account compartments** hold user account identifiers created inside your organisation, such as CRM identifiers.
* **Shared user account compartments** hold user account identifiers shared from another organisation - including network identifiers such as UTIQ martechpass.

## Decide your compartments

{% stepper %}
{% step %}

### List the systems that identify your users

A CRM, a loyalty programme, an authentication system, a site-specific account base - each registration system that produces account IDs or profile records is a candidate compartment.
{% endstep %}

{% step %}

### Decide what must stay separate

Create a compartment per system whose accounts and profiles must remain distinguishable on the same user. If two systems share the same account namespace and the same meaning, they can share a compartment.
{% endstep %}

{% step %}

### Create the compartments

Go to **Settings > Organisation > Compartments**, and in the **First-party user account compartments** section create a new compartment with:

| Parameter | What it is                                                           |
| --------- | -------------------------------------------------------------------- |
| **Name**  | The name of the compartment.                                         |
| **Token** | A technical identifier used to link the compartment with the JS tag. |

Record each compartment ID: your imports, your tag calls, and your API calls will reference it alongside the account identifier.
{% endstep %}

{% step %}

### Activate them on your datamarts

* **With a single datamart**, the compartment is activated automatically.
* **With several datamarts**, activate it on each one: go to **Settings > Datamart > Compartments**, select the compartment, open the **More** menu, choose **Edit linked datamarts**, and select the datamart.

For a compartment created at community level, activate it across organisations by selecting **Enable Compartment** in the **Shared user account compartments enabled** section.
{% endstep %}

{% step %}

### Attach processing activities where needed

Compartments can carry a privacy wall in the same way channels can - see below.
{% endstep %}
{% endstepper %}

## Attaching a processing activity to a compartment

To activate the privacy wall on a compartment, go to **Settings > Datamart > Compartments** and edit the compartment. In the **User Choices - Privacy Wall** section, add the processing activity or activities that justify the capture of personal data, then save.

From that moment, for a new or existing user, when saving a user profile related to the compartment the platform automatically checks the user's choices. If the choices are not compatible, the user profile is dropped.

{% hint style="danger" %}
Make sure you already have valid user choices in your datamart - or `$set_user_choice` events in your user activities - **before** enforcing this configuration. Dropped data cannot be recovered.
{% endhint %}

## Compartments and user-based network IDs

Compartments are not only for your own systems. Integrating a **user-based network ID** follows the same shape as integrating a device-based one, with a compartment in place of a device registry:

1. Create a new compartment, or subscribe to an existing one.
2. Activate it on the datamarts concerned - only necessary when your environment has several datamarts.
3. Activate its ingestion on your channels.

See [Network IDs](/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/user-identity/network-ids.md).

## Verify

* Each registration system in scope has a compartment, or you have decided deliberately that it shares one.
* You have recorded the compartment IDs your imports and API calls will use.
* If you enforce a privacy wall, valid user choices already exist in the datamart.

## Related pages

<table data-view="cards" data-search="false"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Channels</strong></td><td>The equivalent decision for sites and apps.</td><td><a href="/setup-and-monitor/plan-and-integrate/set-up-the-environment/set-up-channels.md">Channels</a></td></tr><tr><td><strong>User Account</strong></td><td>How the compartment forms part of the account identifier.</td><td><a href="/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/user-identity/user-identifiers/user-account.md">User Account</a></td></tr><tr><td><strong>Device registries</strong></td><td>The device-side equivalent of a compartment.</td><td><a href="/setup-and-monitor/plan-and-integrate/set-up-the-environment/set-up-device-registries.md">Device registries</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/setup-and-monitor/plan-and-integrate/set-up-the-environment/set-up-compartments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
