Browser Session Based Recommendation
Overview
Session-based recommendations provide personalized suggestions based on real-time user interactions within a session. This approach is ideal for environments where users' preferences might shift rapidly, such as during a single visit to a website.
Use Case
This method is suited for scenarios where users interact with various items in a short period, and these interactions can be leveraged to recommend additional, relevant items before the session ends.
Gathering Session Information
To implement session-based recommendations, first collect user interactions within the current session. This typically involves tracking clicks, views, or other forms of engagement with items, and can be achieved using client-side scripting (like JavaScript) to capture these events and timestamps.
Example of Gathering User Interactions in a Browser
Use JavaScript to listen for user interactions and store them in an object, which will later be passed to the recommendation engine. Here's a basic example:
Making the API Call
After gathering the necessary data, make an API request to retrieve recommendations. Set recommend_seen
to true
to allow the model to recommend items the user has already interacted with during the session, which can be useful for re-engagement.
API Call Using CURL
Here is how you would send the collected interaction data to your recommendation API using CURL:
Key Parameters
user_interactions
(object): An object containing user interactions, with each key being an item ID and its value being an object that includestimestamp
andrating
.k
(int): The number of recommendations to return.recommend_seen
(bool): If set to true, the model will include items the user has previously interacted with in the recommendations.
Understanding the Recommendations Output
The response from the API will include a list of recommended items along with their relevance scores, indicating the potential interest for the user.
Example Output
Last updated