algolia / recommend

A UI library for Algolia Recommend, available for Vanilla JavaScript and React.
https://www.algolia.com/doc/ui-libraries/recommend/introduction/what-is-recommend/
MIT License
28 stars 11 forks source link

feat: Add Personalized Recommendations (experimental) #174

Closed raed667 closed 10 months ago

raed667 commented 10 months ago

Personalized recommendations

We want to add experimental support for personalized recommendations, using Algolia Personalization "Classic"

This is an experimental UI library implementation that stitches together existing APIs.

A reference guide will also be shared for users who want to implement this in the flavor of their choice.

How to use

To enable personalisation with recommend, you'll need to import from /experimental-personalization like the following:

JavaScript

import { trendingItems } from '@algolia/recommend-js/dist/esm/experimental-personalization';

trendingItems({
  region: 'eu', // "eu" | "us"
  userToken: 'user_token',
  indexName: "indexName"
  // ...

Or by using a standalone endpoint:

<script src="https://cdn.jsdelivr.net/npm/@algolia/recommend-js/dist/umd/experimental-personalization/index.js"></script>

React

import { TrendingItems } from '@algolia/recommend-react/dist/esm/experimental-personalization';

<TrendingItems
  region="eu" // "eu" | "us"
  userToken="user_token"
  indexName="indexName"
  // ...

Or by using a standalone endpoint:

<script src="https://cdn.jsdelivr.net/npm/@algolia/recommend-react/dist/umd/experimental-personalization/index.js"></script>

We avoid using the pre-existing queryParameters for userToken to avoid unexpected side-effects as well as possible semantic-versioning headaches if/when personalized recommendations is supported by the Recommend API and the experimental parameter is removed.

Parameters

The following parameters are all required for personalization:

Notes

github-actions[bot] commented 10 months ago

PR Preview Action v1.4.6 :---: Preview removed because the pull request was closed. 2024-02-01 10:14 UTC