We’re running into an issue with the recommenders with our SPA (Singe Page Application) implementation using ReactJS. The problem is that recommenders only show in the SPA when the page is refreshed. This seems to be related to how the different calls are being made into target.
For the initial load of a page, the page load request is sent but for all subsequent pages, just the triggerView call is sent. This is because for a SPA the page doesn’t reload, it just changes the content in the views. In my testing it seems that ONLY the page load request seems to load the recommenders, not the triggerView. I did some debugging of the launch code and it seems to have confirmed it. When trigger view is called, it just tries to load and view changes out of the local cache and then tries to render it. For something like an A/B test there are changes present and are rendered accordingly. For recommenders however, there isn’t an entry stored in that local cache and the recommenders aren’t loaded.
I’ve attempted to use the getOffer call to refresh the cache, however that doesn’t seem to work either. What this boils down to is 2 questions.
Solved! Go to Solution.
Hi @jarodrose
Could you please help me understand what you mean by recommender? If you are talking about recommendations. It does work on SPA pages.
However, for this to work you need to implement a trigger view to fire target on each page irrespective of page load.
for more information read the below document.
Hope this helps.
Hi @jarodrose
Could you please help me understand what you mean by recommender? If you are talking about recommendations. It does work on SPA pages.
However, for this to work you need to implement a trigger view to fire target on each page irrespective of page load.
for more information read the below document.
Hope this helps.
No, that unfortunately does not help as that is what I followed to troubleshoot this problem. Trigger view is fired every view refresh in the SPA, so one would assume the recommendations would, but they do not. The only way they seem to fire is if I force the initial page load to fire via refresh. Or an alternative would be to call getOffer/applyOffer with no parameters which is effectively a pageload call as well. This seems to be an issue with the cache that trigger view uses not being populated with the recommendation. But, I'm not sure on the best way to proceed as even once I get it to load, it's still not in the cache so if I navigate away from the page/view and go back the recommendation is gone until I refresh the page where it was supposed to render.
Views
Like
Replies
Views
Likes
Replies
Views
Like
Replies