Work with multi-value attributes multi-value-attributes

On this page: Learn how to send multi-value data to Adobe Target Recommendations and how to use it in inclusion rules with the multi-value operators.

A multi-value field holds several values for the same item or visitor. For example:

  • Movies offered to users: a given movie has multiple actors.
  • Tickets sold for concerts: a given user has multiple favorite bands.
  • Clothing sold: a shirt is available in multiple sizes.

To handle recommendations in these scenarios, multi-value data can be passed to Target Recommendations and used with special multi-value operators.

Send multi-value data send

To allow Recommendations to identify multi-value data, it should be sent as a JSON array.

For a multi-value parameter in JavaScript (targetPageParams), see Implementing multi-value attributes in Custom entity attributes.

In a CSV file, a multi-value entity attribute is sent as a JSON array in the cell of the attribute, as in the following sample.

Sample CSV file with a multi-value attribute
code language-none
## RECSRecommendations Upload File,,,,,,,,,,,,,,,,,,,
## RECS''## RECS'' indicates a Recommendations pre-process header. Please do not remove these lines.,,,,,,,,,,,,,,,,,,,
## RECS,,,,,,,,,,,,,,,,,,,
## RECSUse this file to upload product display information to Recommendations. Each product has its own row. Each line must contain 19 values and if not all are filled a space should be left.,,,,,,,,,,,,,,,,,,,
## RECSThe last 100 columns (entity.custom1 - entity.custom100) are custom. The name 'customN' can be replaced with a custom name such as 'onSale' or 'brand'.,,,,,,,,,,,,,,,,,,,
## RECSIf the products already exist in Recommendations then changes uploaded here will override the data in Recommendations. Any new attributes entered here will be added to the product''s entry in Recommendations.,,,,,,,,,,,,,,,,,,,
## RECSentity.id ,entity.name,entity. categoryId ,entity. message ,entity.thumbnailUrl ,entity.value ,entity.pageUrl ,entity.inventory ,entity.margin ,entity.custom1 ,entity.custom2 ,entity.custom3 ,entity.custom4,entity.custom5,entity.custom6,entity.custom7,entity.custom8,entity.custom9,entity.custom10,
1,Sample Product 1,category1,Save 10%,http://sample.store/products/images/product1_th.jpg,325,http://sample.store/products/product_detail.jsp?productId=1,1000,48,a,"[ ""v1"", ""v2"" ]",, , , , , , , ,
2,Sample Product 2,category1,Save 10%,http://sample.store/products/images/product2_th.jpg,369,http://sample.store/products/product_detail.jsp?productId=2,1000,52,a,"[ ""v1"", ""v2"" ]",, , , , , , , ,
3,Sample Product 3,category1,Save 10%,http://sample.store/products/images/product3_th.jpg,479,http://sample.store/products/product_detail.jsp?productId=3,1000,78,a,"[ ""v1"", ""v2"" ]",,,,,,,,,
4,Sample Product 4,category1,Save 10%,http://sample.store/products/images/product4_th.jpg,409,http://sample.store/products/product_detail.jsp?productId=4,1000,66,a,"[ ""v1"", ""v2"" ]",,,,,,,,,
5,Sample Product 5,category1,Save 10%,http://sample.store/products/images/product5_th.jpg,325,http://sample.store/products/product_detail.jsp?productId=5,1000,45,a,"[ ""v1"", ""v2"" ]",,,,,,,,,

When an entity attribute, profile attribute, or mbox parameter is provided as multi-value in this format, Recommendations automatically infers that the field is multi-value.

Use multi-value attributes in inclusion rules multi-value-inclusion-rules

The following operators are available for use with multi-value entity, profile, and mbox attributes:

  • is contained in list
  • is not contained in list
NOTE
Support for dynamic matching to multi-value attributes is currently available only in criteria that use a profile attribute matching or parameter (mbox) attribute matching rule that compares a single value on the left side to a multi-value on the right side. Multi-value attributes are not currently supported in promotions, entity attribute matching, or for lists on the left side of inclusion rules.

Example: Exclude recently watched items

To prevent any movies in the last ten watched movies of the user from being recommended, first write a profile script called user.lastWatchedMovies that tracks the last ten viewed movies as a JSON array. The items can then be excluded with the following inclusion rule:

Profile Attribute Matching
id - is not contained in list - user.lastWatchedMovies

JSON API representation of the inclusion rule:

{
    "attribute": "id",
    "operation": "isNotContainedInList",
    "source": {
        "name": "user.lastWatchedMovies",
        "type": "PROFILE"
    }
}

Example: Recommend items from the user’s favorites

To recommend concert tickets only when the band playing is one of the favorite bands of the user, two items are required: a profile variable called profile.favoriteBands that contains the favorite bands of the user, and an attribute entity.artistPerforming in the catalog that contains the artist performing in the concert. The following inclusion rule can then be used:

Profile Attribute Matching
artistPerforming - is contained in list - profile.favoriteBands

JSON API representation of the inclusion rule:

{
    "attribute": "artistPerforming",
    "operation": "isContainedInList",
    "source": {
        "name": "profile.favoriteBands",
        "type": "PROFILE"
    }
}

Example: API creation of criteria recommending items from a user’s favorites

Criteria that use multi-value filtering rules can be created through the Adobe Target APIs, like all criteria. The following example API call creates a criteria where the entity attribute id is contained in the mbox parameter list favorites:

curl -X POST \
  https://<serverhost>/api/recs/<client>/criteria/item \
  -H 'Accept: application/vnd.adobe.target.v1+json' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'User-Agent: <from API client>' \
  -H 'X-Target-user-email: <email address>' \
  -H 'cache-control: no-cache' \
  -d '{
    "name": "viewed criteria",
    "criteriaTitle": "test title",
    "type": "VIEWED_CF",
    "key": "CURRENT",
    "daysCount": "TWO_WEEKS",
    "aggregation": "NONE",
    "backupDisabled": false,
    "partialDesignAllowed": true,
    "configuration": {
        "inclusionRules": [
            {
                "attribute": "id",
                "operation": "isContainedInList",
                "source": {
                    "name": "mbox.favorites",
                    "type": "MBOX"
                }
            }
        ]
    }
}'

This call is paired with JavaScript on the page that passes in the content of the favorites:

<!-- pass in the value of mbox parameter "favorites" as JSON array -->
<script type="text/javascript">
   mboxCreate('myMbox','entity.id=<key>','favorites=["a","b","c"]');
</script>
AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: Explains how to send multi-value data to Adobe Target Recommendations and how to use it in inclusion rules with the multi-value operators.

Intents:

  • Understand what a multi-value field is and when to use one.
  • Send multi-value data to Target Recommendations as a JSON array, including in a CSV file.
  • Use the operators is contained in list and is not contained in list in inclusion rules.
  • Exclude recently watched items from recommendations with a profile script.
  • Recommend items from the favorites of a user.
  • Create criteria that use multi-value filtering rules through the Adobe Target APIs.

Glossary:

  • Multi-value field: a field that holds several values for the same item or visitor.
  • is contained in list (product-specific): an operator available for multi-value entity, profile, and mbox attributes.
  • is not contained in list (product-specific): an operator available for multi-value entity, profile, and mbox attributes.

Guardrails:

  • Support for dynamic matching to multi-value attributes is currently available only in criteria that use a profile attribute matching or parameter (mbox) attribute matching rule that compares a single value on the left side to a multi-value on the right side.
  • Multi-value attributes are not currently supported in promotions, entity attribute matching, or for lists on the left side of inclusion rules.

Terminology:

  • Canonical name: multi-value attributes (variants: multi-value field, multi-value data)
  • Product name: Adobe Target Recommendations (variants: Target Recommendations, Recommendations)

FAQ:

  • How does Recommendations identify multi-value data? It should be sent as a JSON array, and when an entity attribute, profile attribute, or mbox parameter is provided as multi-value in this format, Recommendations automatically infers that the field is multi-value.
  • How is a multi-value entity attribute sent in a CSV file? As a JSON array in the cell of the attribute.
  • Which operators can be used with multi-value entity, profile, and mbox attributes? is contained in list and is not contained in list.
  • Can multi-value attributes be used in promotions? No, multi-value attributes are not currently supported in promotions.
  • Can criteria that use multi-value filtering rules be created through the APIs? Yes, they can be created through the Adobe Target APIs, like all criteria.

Examples:

  • Exclude recently watched items: to prevent any movies in the last ten watched movies of the user from being recommended, write a profile script called user.lastWatchedMovies that tracks the last ten viewed movies as a JSON array, then use the inclusion rule Profile Attribute Matching id - is not contained in list - user.lastWatchedMovies. Its JSON API representation uses the operation isNotContainedInList with a source of type PROFILE.
  • Recommend items from the favorites of the user: to recommend concert tickets only when the band playing is one of the favorite bands of the user, two items are required, a profile variable called profile.favoriteBands and an attribute entity.artistPerforming in the catalog. The inclusion rule is Profile Attribute Matching artistPerforming - is contained in list - profile.favoriteBands. Its JSON API representation uses the operation isContainedInList with a source of type PROFILE.
  • API creation of criteria recommending items from the favorites of a user: an API call to https://<serverhost>/api/recs/<client>/criteria/item creates a criteria where the entity attribute id is contained in the mbox parameter list favorites (operation isContainedInList, source of type MBOX). This call is paired with JavaScript on the page that passes in the content of the favorites with mboxCreate, as a JSON array.
  • Scenarios for a multi-value field: movies offered to users (a given movie has multiple actors), tickets sold for concerts (a given user has multiple favorite bands), clothing sold (a shirt is available in multiple sizes).

Related pages:

  • For a multi-value parameter in JavaScript (targetPageParams): Implementing multi-value attributes (c-recommendations/c-products/custom-entity-attributes.md)

Personas:

  • marketer: Can use the operators is contained in list and is not contained in list with multi-value entity, profile, and mbox attributes in inclusion rules. The page states that support for dynamic matching to multi-value attributes is currently available only in criteria that use a profile attribute matching or parameter (mbox) attribute matching rule that compares a single value on the left side to a multi-value on the right side. Where: “Use multi-value attributes in inclusion rules”.
  • developer: Can send multi-value data to Recommendations as a JSON array, send a multi-value entity attribute in a CSV file as a JSON array in the cell of the attribute, and create criteria that use multi-value filtering rules through the Adobe Target APIs. The page states that Recommendations automatically infers that the field is multi-value when an entity attribute, profile attribute, or mbox parameter is provided in this format. Where: “FAQ”.

Onboarding:

  • Level: Intermediate, Experienced
  • First minimal step: Send multi-value data to Recommendations as a JSON array.
recommendation-more-help
target-help-main