What is @algolia/recommend?
@algolia/recommend is a JavaScript library that provides tools to integrate Algolia's recommendation engine into your application. It allows you to easily implement personalized recommendations, related products, and other recommendation-based features using Algolia's powerful search and recommendation APIs.
What are @algolia/recommend's main functionalities?
Personalized Recommendations
This feature allows you to fetch personalized recommendations for a specific user. By providing the user token and the index name, you can retrieve a list of recommended items tailored to the user's preferences.
const { createRecommendClient } = require('@algolia/recommend');
const recommendClient = createRecommendClient({
appId: 'YourApplicationID',
apiKey: 'YourAdminAPIKey'
});
recommendClient.getPersonalizedRecommendations({
indexName: 'products',
userToken: 'user-123',
maxRecommendations: 5
}).then(({ results }) => {
console.log(results);
});
Related Products
This feature allows you to fetch products related to a specific item. By providing the object ID of the product and the index name, you can retrieve a list of items that are similar or related to the specified product.
const { createRecommendClient } = require('@algolia/recommend');
const recommendClient = createRecommendClient({
appId: 'YourApplicationID',
apiKey: 'YourAdminAPIKey'
});
recommendClient.getRelatedProducts({
indexName: 'products',
objectID: 'product-123',
maxRecommendations: 5
}).then(({ results }) => {
console.log(results);
});
Frequently Bought Together
This feature allows you to fetch items that are frequently bought together with a specific product. By providing the object ID of the product and the index name, you can retrieve a list of items that are commonly purchased along with the specified product.
const { createRecommendClient } = require('@algolia/recommend');
const recommendClient = createRecommendClient({
appId: 'YourApplicationID',
apiKey: 'YourAdminAPIKey'
});
recommendClient.getFrequentlyBoughtTogether({
indexName: 'products',
objectID: 'product-123',
maxRecommendations: 5
}).then(({ results }) => {
console.log(results);
});
Other packages similar to @algolia/recommend
recombee-api-client
Recombee API Client is a library for integrating Recombee's recommendation engine into your application. It offers similar functionalities such as personalized recommendations, related items, and frequently bought together features. Compared to @algolia/recommend, Recombee provides a more extensive set of recommendation algorithms and customization options.
predictionio
PredictionIO is an open-source machine learning server for building and deploying predictive engines. It allows you to create custom recommendation systems, including personalized recommendations and related items. While it offers more flexibility and customization compared to @algolia/recommend, it requires more setup and maintenance.
The perfect starting point to integrate Algolia within your JavaScript project
Documentation •
InstantSearch •
Community Forum •
Stack Overflow •
Report a bug •
FAQ •
Support
✨ Features
- Thin & minimal low-level HTTP client to interact with Algolia's API
- Works both on the browser and node.js
- UMD and ESM compatible, you can use it with any module loader
- Built with TypeScript
💡 Getting Started
To get started, you first need to install @algolia/recommend (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
yarn add @algolia/recommend
npm install @algolia/recommend
Without a package manager
Add the following JavaScript snippet to the of your website:
<script src="https://cdn.jsdelivr.net/npm/algoliasearch/dist/recommend.umd.min.js"></script>
You can now import the Algolia API client in your project and play with it.
import { recommendClient } from '@algolia/recommend';
const client = recommendClient('YOUR_APP_ID', 'YOUR_API_KEY');
For full documentation, visit the Algolia JavaScript API Client.
❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the client. You can also open a GitHub issue
📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the MIT license.