# Configuring Behavior Activation

This feature is a public Beta release.

Configure Behavior Activation in Audience Studio to export behavior data alongside profile attributes. You can configure up to four behavior tables in the Treasure AI Console or through the Audience API, for both batch activations and activation steps within journeys.

## Enable Behavior Activation

Behavior Activation must be enabled at a Parent Segment level.

1. Open Treasure Console.
2. Navigate to Data Workbench > Master Segments.
3. Select an existing parent segment or create a new parent segment. For details, see [Creating Parent Segments](/products/customer-data-platform/data-workbench/parent-segments/creating-parent-segments).
4. Enable Behavior Column Mapping.
![Enable behavior column mapping on the parent segment](/assets/image2023-6-5_16-41-20.dc9e64e5ec6d69f056faee9940d5b155109fdee655b9f33a9652ec131d3de920.cf3845cb.png)
5. Configure the maximum number of rows that can be associated with a single user profile. You can have a maximum of 20 rows associated with a single user profile.


## Activate a Segment with Behavior Data

For general details on segment activation UI elements, see [Customize Activation Output](/products/customer-data-platform/audience-studio/activation/customize-activation-output).

1. Open Treasure Console.
2. Navigate to Audience Studio.
![Navigate to Audience Studio](/assets/image2023-6-5_16-58-36.af34b9b1872d78182020341b35f03cff3d6f2891a54c5bd51823c02c1525461b.cf3845cb.png)
3. Select an existing parent segment or create a new parent segment. For details, see [Creating Parent Segments](/products/customer-data-platform/data-workbench/parent-segments/creating-parent-segments).
4. Select an existing segment or create a new segment within the parent segment.
5. Create a new segment with segment rules that is configured to select behavior data. For details, see [Segments Overview](/products/customer-data-platform/audience-studio/segment/segments-overview). The following screenshot shows a segment that selects purchase behavior among others.


You must select and use the behavior field in the segment rule, if you want to activate it. If you do not use a behavior field, it cannot be activated.

![Segment rules that select purchase behavior](/assets/image2023-6-26_15-1-58.59a6226afd2e38fb70a34d80a2da6772b7fc97e4bc0fc041a30e764e0103e2c2.cf3845cb.png)

When you use match logic ANY and activate attributes and behaviors, for qualifying profiles with no records meeting the rules of the activated behavior table, behavior data value would be marked as NULL. For details, see [Match Logic ANY Example with NULL value](/products/customer-data-platform/audience-studio/segment/rule-operator/match-logic-any-advanced-example)

1. Select the segment.
2. Select the Activations tab.
![Segment Activations tab](/assets/image2023-6-6_11-10-17.0ee478cbf89ce549dab2dca5df6051f8b309d117effa01e7acdf55c932ba8190.cf3845cb.png)
3. Select Create activation.
![Create an activation](/assets/image2023-6-6_11-5-44.831d59286ea43e2dddc5ea9136722168cc8e4d6ce329452e0aef92b972675592.cf3845cb.png)
4. Fill Details as applicable. When selecting a template or activation, you can scroll the list to use **Activation Templates** or **Existing v5** **Activations**.
![Activation details and template selection](/assets/configuring-behavior-activation-2024-09-05.48fa5058eb7fe5138c2332b2544e5bf601cbfa51897fc62e969cb716f72f2a52.cf3845cb.png)
5. Select Output Mapping.
6. In the Behavior Columns section, select Add Table.
![Add a behavior table in Output Mapping](/assets/image2023-6-6_11-18-4.5c91b807a0872c216c3ada8b6a6ad37d424d43e8f78a98fe79fc196b7e970205.cf3845cb.png)
7. Select Add column. You can map a column in the source table to an output column in the output table. This mapping is termed as behavior column mapping. You have the option to rename the output column name.


If you want to order the activation export data by a certain column data, ensure that the source column name has not been mapped to a different output column name.

![Map behavior source columns to output columns](/assets/image2023-6-26_14-53-21.dea73d549eac5dca4c677532f4792f3d80b99e1260d2f1c8a4262d1c0ab5f07f.cf3845cb.png)

1. Behaviors are selected based on the criteria provided. Select the rows that you want to export.
![Select behavior rows to export](/assets/image2023-6-6_11-22-32.2da0aca9d10b320faa4be126515dfcae457dbdb97e168b6338688e10ba49baf7.cf3845cb.png)
2. You can configure additional details based on the row selection, as applicable.


* If "All Rows" or "Top # rows" are selected, attributes are duplicated for each row of exported behavior data. If you select Top # rows, you can configure the number of top rows that you want to export, the column by which the rows are ordered, and the table formatting.
* If only 1 row per profile is required to be exported, select first or last. For output table examples based on row selection, see [Example](/products/customer-data-platform/audience-studio/activation/configuring-behavior-activation#behavior-activation-example).


| Option | Description |
|  --- | --- |
| All rows | All rows from the table. |
| First row | Only the first row. |
| Last row | Only the last row. |
| Top # rows | Specify the number of top rows that needs to be exported.​ |


1. Select Order by to specify the column and configure order of the output table. For details on order and row-column formatting, see [Customize Activation Output](/products/customer-data-platform/audience-studio/activation/customize-activation-output).
![Order behavior data for export](/assets/image2023-6-6_13-18-48.14b3b3ad6a3539e6be68a4dc1db91f0e2d9dbd0ea6c0b4ecf0be50be6f6d2420.cf3845cb.png)
2. (Optional) You can add columns if needed using String Builder. This allows custom text to be added that can help track or associate activations to specific segments, campaigns, or datetime. For details, see [string builder](/products/customer-data-platform/audience-studio/activation/create-new-strings-for-export-using-string-builder).
3. After providing all mandatory information for activation, select Create and submit an activation.


## Configuring Multiple Behavior Tables

You can activate data from up to four behavior tables in a single activation using the Treasure AI Console or the Audience API. Console configuration is available for both batch activations and activation steps within journeys. For background on this capability, see [Multi-Table Behavior Activations](/products/customer-data-platform/audience-studio/activation/behavior-activation-overview#multi-table-behavior-activations).

### Configure Multiple Tables in the Console

Use the same **Output Mapping** flow for batch activations and activation steps within journeys. Before you start, [enable Behavior Activation](#enable-behavior-activation) on the parent segment and include each behavior table in the activation's segment rules. Tables used only inside a referenced segment are not available for selection.

1. Open the activation in Audience Studio. For a batch activation, use the segment's **Activations** tab. For a journey, open its activation step; see [Create a Batch Journey Activation](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation).
2. Select **Output Mapping**.
3. In **Behavior Columns**, select **Add Table** and choose a behavior table from the segment rules.
4. For that table, select **Add column** to map each source column to an output column. You can rename the output columns.
5. Configure that table's **Export**, **Order by**, and **Formatting** options as needed; see [Behavior Activation Example](#behavior-activation-example) for the output options.
6. Repeat steps 3–5 for each additional behavior table, up to four tables in the activation. Select each table only once.
7. Complete the remaining required activation settings and save the activation.


The saved activation includes the selected behavior tables and their column mappings. To edit an existing multi-table activation, reopen **Output Mapping** and update the configuration in **Behavior Columns**. If a table is missing from the selection, check that it is included directly in the activation's segment rules.

### Configure Multiple Tables Through the Audience API

The Audience API remains available for creating and updating multi-table activations. The following sections describe the request fields.

#### Selecting Behavior Tables

To configure multiple tables, send an array of table configurations in the `syndicationBehaviors` field when creating or updating an activation, in place of the `syndicationBehavior` field, which is deprecated in favor of `syndicationBehaviors` but remains accepted for single-table activations during the transition.

* `syndicationBehaviors` accepts up to four items, one per behavior table.
* Each item's `behaviorTableName` identifies the table, and each table you reference must also be included in the activation's segment rules, the same requirement that applies to single-table Behavior Activation.
* A behavior table can appear only once across the `syndicationBehaviors` array.


#### Mapping Columns

Each table's `columns` array maps source columns to output columns, the same behavior column mapping concept used for a single table:

* `column` is the output column name.
* `source.column` is the column name in that behavior table.
* Output column names can repeat across different tables, but should be unique within a single table's `columns` array to avoid ambiguity in the output.


#### Setting Row Limits

Each table's `joinStrategy` field selects which rows are exported for that table, corresponding to the Export options available for a single table:

| Option | Description |
|  --- | --- |
| All | All rows from the table. |
| First | Only the first row. |
| Last | Only the last row. |
| Top-N | The top N rows, where N is set in `joinRow`. |


`joinRow` is only used when `joinStrategy` is `Top-N`, and specifies how many rows to export per profile for that table.

The maximum of 20 rows per profile configured in [Enable Behavior Activation](#enable-behavior-activation) is unchanged for multi-table activations: it applies as a single combined total across all of a profile's behavior tables, not per table.

#### Formatting and Ordering Output

Each table's `formatting` field controls the row-column formatting of that table's output, matching the single-table Formatting options:

| Option | Description |
|  --- | --- |
| rows | Multiple rows per profile. |
| cols | Transpose rows to columns. |


Each table's `orderBy` array specifies the column (`key`) and direction (`ascending` or `descending`) used to order that table's exported rows.

#### Output Behavior

The configured tables are joined using a full outer join, and appear in the output in the order they are listed in `syndicationBehaviors`. For example, a two-table configuration exporting all rows from the first table and the top 3 rows (ordered by `purchased_at`, descending) from the second table:

```json
"syndicationBehaviors": [
  {
    "behaviorTableName": "email_subscription",
    "columns": [{ "column": "email", "source": { "column": "email" } }],
    "joinStrategy": "All",
    "formatting": "cols",
    "orderBy": [{ "key": "email", "order": "ascending" }]
  },
  {
    "behaviorTableName": "purchase_history",
    "columns": [{ "column": "product_name", "source": { "column": "product_name" } }],
    "joinStrategy": "Top-N",
    "joinRow": 3,
    "formatting": "rows",
    "orderBy": [{ "key": "purchased_at", "order": "descending" }]
  }
]
```

For full request and response details, see the [Audience API Reference](/apis/audience-api).

## Behavior Activation Example

The output table data is configured based on the Export, Order by, and Formatting fields.
![Behavior export and formatting options](/assets/image2023-6-23_18-44-36.90398c972688427b79af7821b54d41f5bd004f108c0550b025ab93d2586391ea.cf3845cb.png)

Export provides the following four row selection options:

* All rows
* First row
* Last row
* Top # rows


Order by configures column name to decide the order, and the ordering options are based on the column data type.

![Order behavior data for export](/assets/image2023-6-6_13-18-48.14b3b3ad6a3539e6be68a4dc1db91f0e2d9dbd0ea6c0b4ecf0be50be6f6d2420.cf3845cb.png)

* Alphabetical order (A → Z or Z → A)
* Numerical order (lowest to highest or highest to lowest)
* Timestamp (Earliest to latest or latest to earliest)


Formatting configures the table row-column formatting as follows:

| Option | Description |
|  --- | --- |
| Multiple rows per profile | Allows multiple rows for each profile |
| Transpose rows to columns | Converts rows into columns. |


Consider the following source table sample with attribute and behavior configurations as follows:
Source Table:

![Example source table with attributes and behaviors](/assets/image2023-6-26_14-55-12.072dfe77e4242cd02e711f80382986e0abdf48a01314c83b4eb4739e36feb082.cf3845cb.png)

### Attribute Configuration

![Example attribute column mapping](/assets/image2023-6-23_17-7-48.c54de6c7abbdf83e8ab990ea5d7bcdeb18922c96815dfbe93a2e7ecae6c495b1.cf3845cb.png)

### Behavior Configuration

![Example behavior column mapping](/assets/image2023-6-23_17-4-29.c9a7880d1a3405a3a2030cd88e4bc56a151e41ee709a980dbab862afb2e2713c.cf3845cb.png)

### Output Examples

The following images demonstrate the example output table based on the row selection in Export.

#### All rows

For each profile, all rows are activated.
![Output with all behavior rows](/assets/image2023-6-26_14-56-55.bb3b57bcd886a283720e6daff93a94fc553b57a4c8709dcab0b524d3db9374d6.cf3845cb.png)

First row

Each profile's first record is activated.
![Output with the first behavior row](/assets/image2023-6-26_14-58-11.f202c0eb422689c45e3c243d287291584fa9aef80edad60fa38bf547ace869d9.cf3845cb.png)

#### Last row

Each profile's last record is activated.
![Output with the last behavior row](/assets/image2023-6-26_14-58-48.59e0e00807d08c12d7da0b7d24f662765acd8bf0ffbc220fc07c040d05d08d47.cf3845cb.png)

#### Top # rows

If # is set to 3, the top three rows for each user profile is activated.

![Output with the top three behavior rows](/assets/image2023-6-26_14-59-20.dccebb00d5673c769478c872cea6600dfda861613ddc21d8afc75be682079ecc.cf3845cb.png)