Recommend & Insights APIs and UI Library for JavaScript

Recommend API for JavaScript

Recommend & Insights APIs and UI Library for JavaScript

Sign up

Features

  • Fully integrated into Algolia’s Analytics and Insights API
  • Finds items Frequently Bought Together and Related Products
  • Applies to ecommerce, media, back office, and any other domain
  • Leverages your data and user interactions / analytics to create ML models
  • Comes with filtering and control over confidence thresholds   
  • Perfectly compatible with Algolia’s Search APIs and InstantSearch
  • Comes with a front end library

Version

  • Works in node and all browsers (including IE11+)

Related Integrations

  • InstantSearch for React, Vue, Angular, vanilla 
  • Search APIs

Key links


Get started

Send Events using Insights

1aa('clickedObjectIDs', {
2  userToken: string,
3  index: string,
4  eventName: string,
5  objectIDs: array
6});
7
8aa('convertedObjectIDs', {
9  userToken: string,
10  index: string,
11  eventName: string,
12  objectIDs: array
13});

Get Recommendations - API

1client.getRelatedProducts([
2  {
3    indexName: 'your_index_name',
4    objectID: 'your_object_id',
5  },
6])
7.then(({ results }) => {
8  console.log(results);
9})
10.catch(err => {
11  console.log(err);
12});

Display Recommendations - Front End

1<!--HTML-->
2<div class="relatedProducts"></div>
3
4// JavaScript
5function RelatedItem({ item }) {
6  return (
7    <a href={item.url}>
8      <img src={item.image_link} alt={item.name} />
9      <div>{item.category}</div>
10      <div>{item.name}</div>
11      <div>${item.price}</div>
12    </a>
13  );
14}
15
16relatedProducts({
17  container: '#relatedProducts',
18  recommendClient,
19  indexName,
20  objectIDs: [currentObjectID],
21  itemComponent: RelatedItem,
22});
Get started for freeExplore all developer docs

Built with JavaScript on Algolia

Frontend Tools
Widgets & Plugins

Related Items

Let users discover more items based on what the crowd navigate to in the same session

  • react
  • javascript