This article describes how to use the data types array of strings, array of numbers, and array of booleans.
In this article:
How it Works
Before you begin, familiarize yourself with the following:
Using Attributes
Using Enrichments
Arrays are used to store a list of values. Whereas a string or number attribute can only contain a single value, such as "Home Page" or 12.95 , an array can contain multiple values, such as ["Pants", "Shirts"] or [5.99, 12.95] . Arrays are available for the number, string, and boolean attribute data types.
In this article, arrays are represented in JSON format in all examples.
["Pants", "Shirts", "Shoes"]
[2, 4, 6]
[true, false, false]
[]
Arrays can contain duplicate values.
There are no storage capacity limits for arrays, but these attributes are still limited by the maximum size of the profile after encryption and compression.
Array of Strings Enrichments
The array of strings attribute stores a list of text values.
The array of strings is available in the following scopes: Event, Visit, Visitor.
Add a String
This enrichment adds the value of a string attribute to the array. The added attribute can only be a string, iQ variable, or omnichannel attribute.
Attribute Name: product_name
STARTING VALUE
["Pants"]
ENRICHED WITH
"Shirts"
RESULTING VALUE
["Pants", "Shirts"]
Add an Array of Strings
This enrichment adds all the values from another array to the array. The added attribute can only be an array of strings or an iQ variable.
Attribute Name: product_name
STARTING VALUE
["Pants"]
ENRICHED WITH
["Shirts", "Shoes"]
RESULTING VALUE
["Pants", "Shirts", "Shoes"]
Difference Between Two Arrays
This enrichment takes two arrays as input, and returns a new array containing all values found in the first array but not the second. In this example, values from Wishlist Products that do not also occur in Purchased Products are added to the resulting array.
Attribute Name: Unpurchased Products
STARTING VALUE
[]
ENRICHED WITH
Difference between:
Wishlist Products ["Pants", "Shirt", "Shoes", "Belt"]
and
Purchased Products ["Pants", "Shirt"]
RESULTING VALUE
["Shoes", "Belt"]
This example shows that the resulting attribute value is replaced, not appended to and that repeated values in the first array are removed.
STARTING VALUE
[7, 8, 9]
ENRICHED WITH
Difference between:
Some Numbers [1, 3, 1, 2, 3]
and
Some Other Numbers [3]
RESULTING VALUE
[1, 1, 2]
Reset
This enrichment removes all values from the array.
Attribute Name: product_name
STARTING VALUE
["Shoes", "Belt"]
ENRICHED WITH
RESULTING VALUE
[]
Lowercase
This enrichment lowercases every value in the array.
Attribute Name: product_name
STARTING VALUE
["Shoes", "BELT"]
ENRICHED WITH
RESULTING VALUE
["shoes", "belt"]
Set to Set of Strings
Sets an array of strings to a set of strings. This enrichment replaces all values in the array.
Attribute Name: Active Browser Types
STARTING VALUE
["IE"]
ENRICHED WITH
["Chrome" "FireFox", "Opera"]
RESULTING VALUE
["Chrome" "FireFox", "Opera"]
Add a Set of Strings
Adds a set of strings to a string array. This enrichment preserves the existing values in the array, therefore there can be duplicate items in the resulting value.
Attribute Name: product_name
STARTING VALUE
["Pants"]
ENRICHED WITH
["Pants", "Shoes", "Ties"]
RESULTING VALUE
["Pants", "Pants", "Shoes", "Ties"]
Remove a String from the Array
Specify a first, last, or all instances of a string to remove. This enrichment removes from an array every instance of the item selected for removal.
Attribute Name: product_name
STARTING VALUE
["Pants", "Pants", "Shoes", "Ties"]
ENRICHED WITH
"Pants"
RESULTING VALUE
["Shoes", "Ties"]
Array of Numbers Enrichments
The array of numbers attribute stores a list of numeric values for browsing metrics such as visits, page views, and purchase events.
Numeric values are stored as decimals or integers. Choose the type that matches your needs:
Decimal (default)
Decimal values can have zero (0) or more decimal digits.
Example: 12, 12.0, 12.345
Recommended for attributes that represent monetary values.
Integer
Only whole number values are stored.
Example: 12, -4, 3214
Useful for number attributes that represent quantities, counters, or scores.
The array of numbers is available in the following scopes: Event, Visit, Visitor.
String representations of numbers ("0", "123", "12.95") are converted to their numeric values. All other non-numeric values are ignored.
Add a Number
This enrichment adds a number value to the array. The added attribute can only be a number, iQ variable, or omnichannel attribute. For example, you may wish to add the last purchase value to the rolling purchase_total_history value array.
Attribute Name: purchase_total_history
Starting Value
[12.95]
Enriched With
5.99
Resulting Value
[12.95, 5.99]
Add an Array of Numbers
This enrichment adds all the values from another array to the array. The added attribute type can only be an array of numbers or iQ variable. For example, you may wish to add the array of purchased product prices to an array of all purchased product prices.
Attribute Name: purchased_products_history
Starting Value
[24.99, 12.95]
Enriched With
[5.99, 10.00]
Resulting Value
[24.99, 12.95, 5.99, 10.00]
Reset
This enrichment removes all values from the array. For example, you may wish to remove the last purchase items from the array of last purchases.
Attribute Name: purchase_total_history
Starting Value
[12.95, 5.99]
Resulting Value
[]
Set Array of Numbers to be the Difference of Two Arrays
This enrichment takes two arrays as input, looks for values that occur in one and not the other, and inserts them into the array. In this example, values from Gift Card Amounts that do not also occur in Gift Cards Purchased are added to the resulting array.
Attribute Name: gift_card_not_purchased
Starting Value
[]
Enriched With
Difference between:
Gift Card Amounts [5.00, 10.00, 25.00, 50.00, 100.00, 250.00]
and
Gift Cards Purchased [25.00, 50.00]
Resulting Value
[5.00, 10.00, 100.00, 250.00]
Array of Booleans Enrichments
The array of booleans attribute stores a list of true/false values.
The array of booleans is available in the following scopes: Event, Visit, Visitor.
The strings "true" and "false" (any mix of upper/lowercase) are converted to their respective boolean values. All other non-boolean values are ignored.
Add a Boolean
This enrichment adds a value to the array. The added attribute can only be a boolean, iQ variable, or omnichannel attribute. For example, you may wish to add a boolean to the array to represent that the customer purchased on their last visit.
Attribute Name: did_purchase_on_visit
Starting Value
[true]
Enriched With
false
Resulting Value
[true, false]
Add an Array of Booleans
This enrichment adds all the values from another array to the array. The added attribute type can only be an array of booleans or iQ variables.
Attribute Name: my_booleans
Starting Value
[true]
Enriched With
[false, true]
Resulting Value
[true, false, true]
Reset
This enrichment removes all values from the boolean array.
Attribute Name: did_purchase_on_visit
Starting Value
[true, false, true]
Resulting Value
[]
... View more