Expand my Community achievements bar.

SOLVED

Pass multiple values in a single profile script

Avatar

Level 2

Is it possible to pass multiple values in a profile script?

 

I have 8 products for each user saved to their customer attributes. I am setting up Recommendations and need to setup the Criteria so that it shows these products in the design.

 

Using the script below as example, which returns one of the products, can I set it so that it returns all 8 in one script?

 

if (crs.get('offline customer.userid')) {

return crs.get('offline customer.prod1');

}

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @patrickb8312284,

A profile script generally will return a single value. Though it could be some sort of concatenated string. I think your use case might be better achieved in a different way. If you are wanting Recommendations to generate the results you could try a custom criteria with a custom key. Your custom criteria file could use the visitor's id as the key and then you can list the 8 product id's you want that visitor to see (probably very similar your customer attributes files with new column names). Something like this:

7-28-2020 5-00-33 PM.png

Then you setup a custom key in Recommendations that uses the same visitor id used in your custom criteria. Be sure to set the recommendation key in your custom criteria as the new custom key. Then create an activity that uses your custom criteria and your preferred design.

Hope that helps!

-Ryan

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

Hi @patrickb8312284,

A profile script generally will return a single value. Though it could be some sort of concatenated string. I think your use case might be better achieved in a different way. If you are wanting Recommendations to generate the results you could try a custom criteria with a custom key. Your custom criteria file could use the visitor's id as the key and then you can list the 8 product id's you want that visitor to see (probably very similar your customer attributes files with new column names). Something like this:

7-28-2020 5-00-33 PM.png

Then you setup a custom key in Recommendations that uses the same visitor id used in your custom criteria. Be sure to set the recommendation key in your custom criteria as the new custom key. Then create an activity that uses your custom criteria and your preferred design.

Hope that helps!

-Ryan