Developer Documentation
Testing Product Recommendations
Use this JavaScript snippet to manually set your browsing history for testing the AI recommendation engine.
How to use:
- Open your running application in the browser.
- Open the developer tools (usually by pressing F12 or Cmd+Opt+I).
- Go to the "Console" tab.
- Copy and paste the code below into the console and press Enter.
- Refresh any product page to see the recommendations update.
// A sample browsing history with a few products.
const newHistory = [
{ "id": "1", "name": "The Minimalist Tote" },
{ "id": "2", "name": "Relaxed Fit Blue Jeans" },
{ "id": "8", "name": "Chunky Knit Sweater" },
{ "id": "10", "name": "Tailored Black Trousers" }
];
// Set the history in sessionStorage.
sessionStorage.setItem('browsingHistory', JSON.stringify(newHistory));
// Log to the console to confirm it was set.
console.log('Browsing history has been updated. New history:', JSON.parse(sessionStorage.getItem('browsingHistory')));
// Refresh the page to see the new recommendations.
console.log('Please refresh the page to see the changes take effect.');