Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

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

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

 

View solution in original post

2 Replies

Avatar

Level 8

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

Avatar

Correct answer by
Employee Advisor

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