How to set an array in an evar via processing rule? | Community
Skip to main content
Level 2
Aug 20, 2021 7:56 AM UTC
Solved

How to set an array in an evar via processing rule?

Hi, I have to track a variable which is in a form of an array, for e.g.,

I have to track hobbies of a person landing up on my site, so as soon as they log in, I want to send that along with other user details, like their name, age etc. Right now, I am doing something like this,

const contextData = { userName: 'ABC', age: 32 } ACPCore.trackState('Homepage', contextData);

Now, I want to track hobbies too, let's say hobbies for above user are reading, skating, dancing.

So, I am modifying my existing implementation to,

const contextData = { userName: 'ABC', age: 32, hobbies: ['Reading','Skating','Dancing'] } ACPCore.trackState('Homepage', contextData);

What changes do I need to make in processing rules to map hobbies which is an array to an evar?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
VaniBhemarasetty
VaniBhemarasettyAccepted solution
Employee
Aug 21, 2021 2:23 PM UTC

@vivek091195 Adding to Brian's answer , you can asisgn it to a list variable, once the the values are separated by a delimeter, this can be assigned to listVar, where each value is becomes a separate dimensio in reporting

This documentation explains how to configure a listVar

https://experienceleague.adobe.com/docs/analytics/admin/admin-tools/conversion-variables/list-var-admin.html?lang=en

 

2 replies

VaniBhemarasetty
VaniBhemarasettyAccepted solution
Employee
Aug 21, 2021 2:23 PM UTC

@vivek091195 Adding to Brian's answer , you can asisgn it to a list variable, once the the values are separated by a delimeter, this can be assigned to listVar, where each value is becomes a separate dimensio in reporting

This documentation explains how to configure a listVar

https://experienceleague.adobe.com/docs/analytics/admin/admin-tools/conversion-variables/list-var-admin.html?lang=en

 

Translate
Brian_Johnson_
Level 8
Aug 20, 2021 3:12 PM UTC

@vivek091195 - You're probably best converting the array to a delimited string ("Reading,Skating,Dancing") when you add it to the contextData object. Then, in your Processing Rules, you'll just assign the variable to the appropriate eVar/prop.

Translate