Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 1st edition of the Target Community Lens newsletter is out now! Click to the right to find all the latest updates
SOLVED

Can i get category affinity values in Experiences through code?

Avatar

Level 2

Hi,

 

I am facing a hard time getting first category, second category etc. values inside experiences through custom code within Adobe target. I can use user.categoryAffinity to get the value in it. But, is there any way to get first category, second category etc values as well by doing something similar ?

 

Thanks in advance.

 

Regards,

Nitish

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @lambanitish 

 

You can use profile script to fetch category affinity array using "user.categoryAffinities" and then consider first element of array as first favorite category, second as a second and so on. 

 

once you store category affinity array in profile script, fetch it into your code using "${user.profilescriptname}".(double/single quotes are mandatory while fetching profile script value)

 

Hope this helps.

2 Replies

Avatar

Correct answer by
Employee

Hi @lambanitish 

 

You can use profile script to fetch category affinity array using "user.categoryAffinities" and then consider first element of array as first favorite category, second as a second and so on. 

 

once you store category affinity array in profile script, fetch it into your code using "${user.profilescriptname}".(double/single quotes are mandatory while fetching profile script value)

 

Hope this helps.

Avatar

Level 2

thank you, @Gaureshk_Kodag 

I was looking for something direct out of the box like user.firstCategory but this will do. 🙂

 

Regards,

Nitish