Information for: DEVELOPERS   PARTNERS

Decision Tree node

Decision Tree node

The Decision Tree Node is commonly used across processes that are used to filter records through exclusion logic, apply a dynamic segmentation, or decide what kind of content a person is going to receive in a tweet, email, or personalized web experience. As the decision tree node is a generic piece of logic, it has a wide range of uses and applications.

A decision tree consists of columns, each referred to as a characteristic, and rows, each referred to as a condition. You can define as many characteristics as you need. The decision tree executes beginning from the top left condition, testing each condition in turn until either a True value is found or the Else condition is reached.

The value of each characteristic comes from your graph’s Data schema, Public variables, and Literals. When you create a new characteristic, it has two conditions, or branches. You can add more conditions as needed. Each characteristic always has an Else branch that executes if no other branch evaluates to True. As Acquia Journey executes along a decision tree branch, it will return the value in the Result column once it fully executes a branch.

Decision tree node example

In the preceding example decision tree node, Gender, Age, and Shoe Size are characteristics. Each characteristic column has several conditions. For the decision tree to return the “young woman” result, the decision tree will execute in the following sequence:

  1. Gender - The condition “Female” evaluates as True
  2. Age The condition VAL < 25 evaluates as True
  3. Shoe Size The characteristic evaluates its conditions:
    1. VAL < 4 The condition evaluates as False
    2. The Else branch executes as all other possibilities are exhausted
  4. After all characteristics are evaluated, the result “young woman” is returned.

Creating a decision tree node

To create a decision tree node, perform the following actions:

  1. Sign in to your Acquia Journey interface.

  2. Find the tile for the project that you want to modify, and then click its Project Editor Project Editor icon icon .

  3. In the top left of the page, click the Action Menu Action menu icon.

  4. Click Create New.

  5. In the Name field, enter the name of your new decision tree node.

  6. In the Type section of the Create a New Item view, scroll through the list of node types to find its Logic section, and then click Decision Tree.

    Logic node type listing

  7. Click Create New Item.

Next, you must configure your new decision tree node.

Configuring a decision tree node

A decision tree characteristic always includes an Else conditional branch and at least one user-defined conditional branch. To configure a decision tree note, perform the following steps:

  1. Create a decision tree node with one characteristic and one branch:

    Default decision tree image

  2. To add additional characteristics, click the Plus icon at the top left of your decision tree and provide the name for the new characteristic.

  3. To add more conditions to evaluate for a characteristic, click the Plus icon to the left of the item you want to expand.

Decision tree expansion

Acquia Journey saves your changes as you configure your decision tree.

Editing characteristics or conditions

After creating a characteristic or condition, edit it by performing the following steps:

  1. Click the condition that you want to edit.
  2. In the right pane, scroll to the Edit Rule panel, and then click the expand icon to display its entire contents.
  3. Optionally, provide a description for your condition.
  4. Click to select Basic or Advanced operations. (Learn more about how Conditions and expressions work in Acquia Journey.)
  5. For Advanced conditions, supply the logic for your condition; for Basic conditions, click the Select box to select your condition, and if required, provide the values needed to complete your conditional.
  6. Click Save Changes to Condition.

Providing results for each conditional

After creating your characteristics and their conditionals, supply the results for each conditional. Results can be in the form of literals (hard-coded, static variables), a section of your schema, or a dynamic field in your schema.

  1. Sign in to your Acquia Journey interface.
  2. Find the tile for the project that you want to modify, and then click its Project Editor Project Editor icon icon.
  3. In the top left of the page, click the Action Menu Action menu icon .
  4. Click Open.
  5. Find the name of the decision tree you want to edit and click its name, then click Open.
  6. In the Results column, select the result you want to edit, select a value from either the Data schema or Public variables panels or enter a specific value in the Literals panel. In the Edit Result Value panel, click the left arrow icon left arrow to set the Result value for this decision tree node.

Mapping characteristics to data sources

For each created characteristic, you must add a data source in the list of parameters outside of the node at the graph level. To add data sources, perform the following steps:

  1. Sign in to your Acquia Journey interface.
  2. Find the tile for the project that you want to modify, and then click its Project Editor Project Editor icon icon.
  3. In the Graphs section of the project editing page, double-click the graph that you want to edit.
  4. In your graph, click the icon for the decision tree node that you want to configure.
  5. In the right sidebar, scroll to the Edit panel.
  6. For each Characteristic, provide a source for the data. Select a value from either the Data schema or Public variables panels or enter a specific value in the Literals panel. In the Edit panel, click the left arrow icon left arrow for the characteristic. Repeat for each remaining characteristic.
  7. Save your changes.

Validation warnings

Warning Description
All decision tree result destination must be valid data reference formats The results returned can either be strings or JSON objects and cannot be blank.
All decision tree condition nodes must be valid JavaScript or ‘else’ A condition node needs to have valid JavaScript in order to evaluate if a condition is true or not. If no conditions are needed, simply delete the branch so that it will evaluate true.