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.
Familiarize Yourself with JavaScript
For those unfamiliar with what JavaScript is and its role in web development, it is a versatile programming language commonly used to create interactive and dynamic web pages. JavaScript enables real-time updates, smooth animations, and improved user experiences, making it an essential component of modern web applications.
If you’re wondering how to use an API JavaScript, it involves making requests to an external service and handling the returned data within your script. With this enhancement, developers can now more easily integrate Fresh Relevance’s API by listening to specific events and sending relevant data, ensuring a seamless and responsive user experience.