How to set an array in an evar via processing rule? | Community
Skip to main content
Level 2
August 20, 2021
Solved

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

  • August 20, 2021
  • 2 replies
  • 1366 views

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.
Best answer by VaniBhemarasetty

@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

Brian_Johnson_
Level 8
August 20, 2021

@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.

VaniBhemarasetty
Adobe Employee
VaniBhemarasettyAdobe EmployeeAccepted solution
Adobe Employee
August 21, 2021

@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