This Enrichment is used to save the values from an Array of Strings Attribute into a Set of Strings Attribute. It works just like the Add to Set of Strings Enrichment, but uses an Array Attribute instead of a single String Attribute.
|Array of Strings||Set of Strings|
|["Prod123", "Prod456"]||"Prod123", "Prod456"|
|["BrandX", "BrandX", "BrandY"]||"BrandX", "BrandY"|
Important: By design, this Enrichment will not create a perpetual Set. This means you cannot append to a Set of String using this enrichment, it will always overwrite it completely.. To preserve the Set of Strings and append new values you must use the Update Set of String By Set of Strings Enrichment. More details on this are covered in the Usage Example section below.
1. Add a new Set of Strings Attribute. Give it a Title and set its Scope.
2. Click the 'Add Enrichment' button and select 'Store Array as Set of Strings'.
3. Select the target Attribute from the first dropdown.
4. Choose a trigger from the WHEN drop-down menu.
3. Apply one or more Rule conditions that determine when to trigger the Enrichment. You may attach an existing Rule or create a new Rule condition.
4. When you are done, confirm the changes by clicking on Save/Publish at the top-right corner.
Suppose you want to draw up a Set of unique product IDs for all products that a visitor purchased during his or her latest visit. Remember that product IDs should be stored in an array of strings. Clearly, the 'Add to Set of Strings' is not a feasible choice here since it cannot handle arrays. The only way to turn this array of product ids Set is by triggering 'Store Array as Set of Strings' on the receipt page. Because doing that will overwrite any existing Set values, you have to first convert the product_id array to a temporary Set, then use "Update Set of Strings by Set of Strings" to update a master set with your temporary set. Let's review each step in detail.
Before you begin, add a new "product_id" Array of Strings to your AudienceStream profile. Either that or make sure the matching Data Source (aka Event Attribute) is already imported from Tealium iQ.
STEP 1: Add a new visit-scoped Set of Strings. Then create 'Store Array as Set of Strings' Enrichment.
For this set, set the value to: "product_id" WHEN:ANY_EVENT Attach/Create Rule: Current URL contains(ignore case) receipt.html
STEP 2: Add another visitor-scoped Set and title it "Products Purchased - Master List". To this, add the 'Update Set of Strings by Set of Strings' Enrichment.
WHEN: Visit Ended
STEP 3: Save/Publish the changes.
The instant a visitor lands on the receipt.html page, the 'product_id' string Array is populated with the array of ids from the final order. Following each event from the visitor, the array is transformed to a Set and placed in the 'Products Purchased' Set. At the end of the visit, the 'Update Set of Strings By Set of Strings' triggers and appends the set to the 'Product Purchased-Master Set'. This cycle of storing arrays and updating the Master Set happens every time the same visitor makes a purchase on your site.