Recommendations
Three kinds of recommendations, each a single request:
| From | Needs events | Plan | |
|---|---|---|---|
| Related items | What records are about | No | All plans |
| Trending | Recent activity | Yes | Starter and up |
| Bought together | Orders | Yes | Growth and up |
None of them count towards your search quota. Each one has a toggle in the app’s
settings (related.enabled, trending.enabled, boughtTogether.enabled), on
by default.
Related items
Section titled “Related items”Records similar in meaning to a given record, from their embeddings rather than shared tags: a trail shoe’s related items are other trail shoes, even ones in a different category with no tags in common.
const hits = await client.related("sku-1042-en", { limit: 4 });curl -s "https://api.shoofai.co/v1/apps/$SHOOF_APP/records/sku-1042-en/related?limit=4" \ -H "x-shoof-api-key: $SHOOF_SEARCH_KEY"limit is 8 by default, up to 50. Related items are in the same language as the
record (or lang), and of the same type unless you turn related.sameType
off, so a product page shows products and an article shows articles.
Trending
Section titled “Trending”Trending items
Section titled “Trending items”GET /trending returns the records whose activity in the last 24 hours is well
above their usual rate: at least 1.5 times their daily average over the 6 days
before.
const hits = await client.trending({ limit: 10, lang: "en", type: "product" });Activity is weighted by intent: a view counts 0.5, a click 1, an add to cart 3
and a purchase 6. To keep a single visitor from making something trend, an item
needs at least 3 recent events from at least 2 visitors on 2 different networks.
Each hit has a _trending score.
Take limit (10 by default), lang, type and filters (JSON). A secured
key’s filters apply.
To show them without code, use the widget’s data-shoof-trending
element, or the WordPress plugin’s Shoof AI Trending
block.
Trending searches
Section titled “Trending searches”GET /trending/queries returns the searches rising the same way, that found
results. A good “Trending now” list for an empty search box.
{ "queries": [{ "query": "linen shirt", "count": 64, "score": 3.2 }] }Bought together
Section titled “Bought together”GET /records/{id}/bought-together returns the records most often bought in the
same order as this one, for “Frequently bought together” on a product page.
const hits = await client.boughtTogether("sku-1042-en", { limit: 4 });It’s built from the last 90 days of conversion and add_to_cart events
(add-to-carts weigh 0.3 of a purchase). Items are grouped into baskets by the
events’ orderId, or without one, by visitor in sessions of up to 30 minutes
between events. A pair needs to share at least 2 baskets, and recent orders
count for more. Each hit has _together (the strength) and _together_count
(how many baskets had both).
Send the orderId with your conversion events: baskets are much more accurate
with it. The WordPress plugin sends WooCommerce’s order number.
How fresh they are
Section titled “How fresh they are”Trending and bought-together are computed from your events by a job that runs every hour for apps with new events, and at least every 6 hours while your site sends searches or events. Searches read the results through a 5-minute cache. A new app shows no trending items or bought-together pairs until it has enough events. Related items are always current.