Fresh Relevance improved client-side APIs to better support Single Page Apps (SPAs), Progressive Web Apps (PWAs) and modern JavaScript web frameworks such as React, Vue.js and Angular.
Why did we make this enhancement?
These changes have been made to provide enhanced support for SPAs, allowing you to pass behavioral and product data directly to the Fresh Relevance script and receive notifications when the script performs certain actions.
This enhancement also reduces dependency on the detection of page transitions and collection of product information from the page HTML.
What did we change?
We implemented event emitters from the Fresh Relevance script. These allow you to react to events raised by the script, for example when each element of personalization is about to be inserted, or all personalization is complete.
New hooks have also been added so that your script can inform us when events have occurred within your app. An example use case would be when the user navigates from a product list page to a product details page. With the new hooks, you can let us know and pass through details of the product on the page as a JavaScript object.