Expand my Community achievements bar.

Profile Script in at.js

Avatar

Level 2

Hello Everyone,


I am using at.js library. I create an Adobe Activity and Adobe offer in Adobe Target to personalize the content. Whenever I create an Adobe activity, it gives Preview URL which I need to add after the page URL and my personalized content appears. If I close the browser and opens again the same page, I don't see my personalize content because the Preview URL is not there.

I, now, have a requirement that if the user opens the fresh new webpage with Preview URL once, it should set some property in his profile. And now, if the user closes that browser and opens again, it should read that property and know that this user has already seen the personalized content once. Now, there should not be any need to add Preview URL again to see the Personalized content. User should now see the personalized content without adding Preview URL.|

I have already tried using Profile script but it seems I am missing something, its not working for me. Can you please provide practical implementation with all the code for Activity, Offer, Audiences and Profile script. Please also mention where to add profile/user, its the confusing one, which one to use where and why.

Thanks

5 Replies

Avatar

Level 8

think of below approach at high level

- add a Boolean flag/variable in the profile script which by default is false and set to true when the given URL+ preview condition is true or accessed by the end user

- add value to offer variable to get offer by : adobe.target.getOffers().

- on the next visit check the Boolean flag if true then use adobe.target.applyOffers().// pass stored offer variable

 

@singalashwani 

Avatar

Level 2

Thanks @Rite18 for suggesting a solution.

 

1. As suggested, I tried updating the flag in profile script but the setter method is NOT working here. I tried updating the flag as below:
profile.set('<FLAG-NAME>', true);

and

user.set('<FLAG-NAME>', true);

 

None of above is working in profile script.

 

2. Can you please write small code snippet for adobe.target.getOffers().

 

Thanks for your help.

Avatar

Level 8

@singalashwani  I do not have an instance to write a code here, my inputs are conceptual [not exact one] at a high level, if you have access to the target instance, try to get/set the required conditions and variables in the profile script editor   and make change as needed 

Avatar

Level 2

Thanks @Rite18 for helping. I'll try writing this in Target instance.

Avatar

Level 2

Is the activity Live (Activated)?  If you are using the Preview URL to run it then I'm guessing no.  If the activity is not activated then it doesn't matter what the Profile Script does, the activity will not run until you either activate it or use the Activity QA links (preview URL).