since ‎28-06-2019
‎10-12-2019
jasonc75785792
Level 2
Re: Using Profile Script token values in Activities A/B test custom code
Avatar

jasonc75785792

jasonc75785792
- Adobe Target
An example use case would be storing the last view pages. In the Profile Script, I can just add page.path into an array and then use that array in the Activity.Profile Script (user.testValue)var testValue = user.get('testValue') ||[];testValue.push(page.path);return testValue.slice(0, 10);in Activity custom codevar lastPageViews = ${user.testValue}; console.log(lastPageViews[0]); In this example I can easy store the last 10 pages the user viewed and get access to it in an A/B test. This is just ...

Views

423

Likes

2

Replies

0
Re: Using Profile Script token values in Activities A/B test custom code
Avatar

jasonc75785792

jasonc75785792
- Adobe Target
I need the quotes so I can just use the value as a string array like below.var profileValue = ${user.testValue}; console.log(profileValue[0]); to getI could set the value as ["'test'", "'blue'"] but then I would have to manage the extra quotes within the Profile Script. Also, that doesn't work.

Views

420

Like

1

Replies

0
Using Profile Script token values in Activities A/B test custom code
Avatar

jasonc75785792

jasonc75785792
- Adobe Target
Hi, for Profile Scripts you can use JavaScript arrays and objects as the values and it works fine within the Profile Script. However accessing the value in an Activity A/B test via Custom Code Modifications the values aren't deserialized the same.Profile Script (user.testValue)return ['test', 'blue'];orreturn {key1: 1, key2: 2};Within an Activity A/B test modification custom codevar profileValue = "${user.testValue}";console.log(profileValue);The console output will beandBasically for string arr...

Views

947

Likes

2

Replies

5
Likes from