Product Recommendations
Product recommendations are a fundamental part of almost every successful e-commerce experience. From "Top Picks for You" on the homepage, to "Customers Also Bought" on product detail pages (PDPs), or "Related Items" in the cart, these modules aim to help shoppers discover relevant products they might not have found otherwise. Effective recommendations drive significant business value by increasing product discovery, boosting click-through rates (CTR), improving conversion rates, and lifting average order value (AOV). However, building recommendation systems that go beyond simple "most popular" lists and deliver truly personalized, high-performing suggestions requires tackling substantial technical challenges.
Building Product Recommendations with Shaped
Let's illustrate implementing homepage recommendations using Shaped.
Goal: Display a "Top Picks For You" carousel on the homepage for logged-in users.
1. Ensure Data is Connected: Assume you have connected:
user_interactions
: Containsuser_id
,item_id
(product ID),timestamp
,event_type
(view, add_to_cart, purchase).product_catalog
: Containsitem_id
,title
,category
,image_url
,product_url
, price.
2. Define Your Model (YAML): Focus the model on learning preferences from user interactions.
model:
name: homepage_product_recs
connectors:
- type: Dataset
name: user_interactions
id: interactions
- type: Dataset
name: product_catalog
id: products
fetch:
events: |
SELECT
user_id,
item_id,
timestamp AS created_at,
-- Assign weights/labels based on interaction type
CASE
WHEN event_type = 'purchase' THEN 1.0
WHEN event_type = 'add_to_cart' THEN 0.7
WHEN event_type = 'view' THEN 0.1
ELSE 0.0
END as label
FROM interactions
items: |
SELECT
item_id,
title,
category,
brand,
image_url,
product_url,
price
FROM products
3. Create the Model:
shaped create-model --file product_recommendation_model.yaml
4. Monitor Training: Wait for the model to reach the ACTIVE
state.
shaped view-model --model-name homepage_product_recs
5. Fetch Homepage Recommendations: Once ACTIVE
, your website backend (when rendering the homepage for a logged-in user) calls Shaped's rank
API.
- Python
- JavaScript
const { Shaped } = require('@shaped/shaped');
const shapedClient = new Shaped(); // Assumes SHAPED_API_KEY env var
const response = await shapedClient.rank({
modelName: 'homepage_product_recs',
userId: 'USER_456',
limit: 10,
returnMetadata: true
});
console.log(`Rendering ${response.metadata.length} recs for USER_456`);
from shaped import Shaped
shaped_client = Shaped() # Assumes SHAPED_API_KEY env var
response = shaped_client.rank(
model_name='homepage_product_recs',
user_id='USER_456',
limit=10,
return_metadata=True
)
print(f"Rendering {len(response.metadata)} recs for USER_456")
Your frontend receives the list of recommended products (with metadata) and renders the "Top Picks For You" carousel.
(Note: For PDP "Customers Also Bought" or "Related Items," you would typically use the similar_items
endpoint, passing the user_id
and the item_id
of the product currently being viewed.)
Conclusion: Focus on Merchandising Strategy, Not ML Plumbing
Effective product recommendations are crucial for e-commerce success, but building them from scratch requires overcoming substantial hurdles in data engineering, machine learning, infrastructure, and ongoing optimization. Shaped provides the specialized AI platform to handle this complexity.
By connecting your Shopify, database, warehouse, or event stream data to Shaped, you can leverage state-of-the-art models and scalable APIs (rank
, similar_items
) to power high-performing product recommendations across your site with significantly less internal effort. Let Shaped manage the complex AI engine so your team can focus on merchandising strategy, user experience, and driving growth.
Ready to implement product recommendations that truly convert?
Request a demo of Shaped today to see it in action with your specific use case. Or, start exploring immediately with our free trial sandbox.