triggerView() function call sending notifications with old parameters after calling getOffers() and applyOffers()
Hello,
Have been struggling with this issue for a few days now and can't seem to get it to work. Here is the problem:
Our website is a SPA - we implement Target through Adobe Launch. I'm trying to set up some activities for cross sells on certain pages. I.e. Target will be used to offer enrollment for certain programs on given page. A user's eligibility for a program can be determined by a local storage value that we send as a custom parameter to target.
When Target initially loads we get the value of this local storage parameter and send it in a page load request. In testing we found a defect where Target was making an offer for a program on the cross sell page even though the user had already enrolled in that program earlier in the session. When the user enrolled earlier in the session the local storage object was updated but it appears as if the latest version of that custom parameter did not make it to Target.
Upon further investigation I found that the 'notifications' being sent by the triggerView() call in Target seemed to be sending an old version of the eligibility parameter.
Below is a layout of the Custom Code setup I am using in Launch in order to call Target for these offers and trigger the view. The launch rule is kicked off by a custom JS event from the application:
1. Get the local storage parameter containing program eligibility
2. Calls adobe.target.getOffers() API, passing the local storage parameter as a custom param
3. Calls adobe.target.applyOffers() API with response from #2 above
4. Calls triggerView() passing the view name of the cross sell page
When I inspect the network tab I can see that the getOffers() call is sucessfully sending the newest parameter and in return I get a prefetch with the views as expected. HOWEVER when I call triggerView() it sends a payload with notifications and that payload has old parameters.
It appears to me that the issue is that getOffers() applyOffers() is not updating the cache and so when I call triggerView() it is sending the older parameters. Any guidance or insight would be super helpful, thanks!
