AI Recommendation
Client Documentation
A comprehensive guide to configuring and using the MTS AI Commerce Assistant extension. This document covers every admin setting, how each AI engine works, frontend integration, and API reference.
🎯 Features Overview
The extension provides 7 AI-powered recommendation engines, 5 placement zones, a full analytics dashboard, and works with Luma, Hyva, and PWA Studio themes.
🔍 Similar Products
Vector embedding similarity using OpenAI. Finds products that are semantically related.
🛒 Frequently Bought Together
Analyzes purchase history to show products commonly bought in combination.
📈 AI Cross Sell
Intelligent cross-sell based on product relationships and customer behavior.
⬆ AI Upsell
Suggests premium alternatives and complementary products to increase cart value.
🕑 Recently Viewed Prediction
Predicts next products based on browsing history and session patterns.
🧠 Purchase Prediction
ML-powered prediction that anticipates customer purchase intent.
⚙ Dynamic Widgets
Configurable carousel/grid/list widgets for any page placement.
📊 Analytics Dashboard
CTR reports, conversion tracking, and performance metrics in admin.
📦 Installation
Follow these steps to install the extension on your Magento 2 store.
Copy the app/code/MageTech/AIRecommendation folder to your Magento installation.
⚙ General Settings
The main on/off switch and basic configuration for the extension.
Path: Stores > Configuration > MageTech > AI Recommendations > General
| Setting | Type | Default | Purpose |
|---|---|---|---|
| Enabled | Yes/No | No | Master switch. Disables all recommendation functionality when set to No. |
| Default Title | Text | Recommended For You | Default title shown above recommendation widgets on the frontend. |
| Log Tracking Events | Yes/No | Yes | Enables logging of user interactions (views, clicks, purchases) for AI learning. |
🤖 AI Provider Settings
Configure the OpenAI API connection for embeddings and completions.
Path: Stores > Configuration > MageTech > AI Recommendations > AI Provider Settings
| Setting | Type | Default | Purpose |
|---|---|---|---|
| AI Provider | Select | OpenAI | Choose between OpenAI or a custom endpoint. OpenAI is recommended for best results. |
| API Key | Password | — | Your OpenAI API key. Get it from platform.openai.com/api-keys. Stored encrypted. |
| Embedding Model | Text | text-embedding-3-small | OpenAI model for generating product vector embeddings. Used for similarity search. |
| Completion Model | Text | gpt-4o | OpenAI model for generating AI recommendations via chat completions. |
| Max Tokens | Number | 1000 | Maximum tokens for AI completion responses. Higher = longer recommendations. |
| Temperature | Number | 0.7 | Controls randomness. 0 = deterministic, 1 = creative. 0.7 is balanced. |
| Timeout | Number | 30 | Maximum seconds to wait for OpenAI API response before timing out. |
| Fallback to Rules-Based | Yes/No | Yes | When AI is unavailable, use rule-based recommendations instead of showing nothing. |
How to get your OpenAI API Key:
https://platform.openai.com/api-keysplatform.openai.com/settings/organization/billing⚡ Recommendation Engines
Toggle individual recommendation engines on or off. Each engine operates independently.
Path: Stores > Configuration > MageTech > AI Recommendations > Recommendation Engines
| Engine | Default | Purpose |
|---|---|---|
| Frequently Bought Together | Enabled | Shows products that are commonly purchased together. Increases average order value. |
| AI Cross Sell | Enabled | AI-driven cross-sell suggestions based on product relationships and customer profiles. |
| AI Upsell | Enabled | Recommends premium or higher-priced alternatives to increase revenue per transaction. |
| Recently Viewed Prediction | Enabled | Predicts what a customer will want to see next based on their browsing history. |
| Similar Products (Vector) | Enabled | Uses OpenAI embeddings to find products with similar descriptions, names, and attributes. |
| Purchase Prediction | Enabled | Analyzes customer behavior patterns to predict likely purchases. |
| Dynamic Widget | Enabled | Flexible widget that adapts its content based on page context and customer data. |
🎨 Display Settings
Control how recommendation widgets look on the frontend.
Path: Stores > Configuration > MageTech > AI Recommendations > Display Settings
| Setting | Type | Default | Purpose |
|---|---|---|---|
| Default Items Limit | Number | 6 | Maximum number of products to show in recommendation widgets. |
| Sort Order By | Select | Relevance | How to sort recommendations: Relevance, Price, Newest, Bestselling, Random. |
| Layout | Select | Carousel | Widget layout: Carousel (slider), Grid (columns), or List (vertical). |
| Show Score | Yes/No | No | Display the AI confidence score on each recommended product (for debugging). |
| Lazy Load Images | Yes/No | Yes | Use native lazy loading for product images to improve page load speed. |
📍 Placement Settings
Configure which pages show recommendations and what title/limit each placement uses.
Path: Stores > Configuration > MageTech > AI Recommendations > Placement Settings
| Setting | Default | Purpose |
|---|---|---|
| Homepage Enabled | Yes | Show recommendations on the homepage. |
| Homepage Title | Recommended For You | Title above the homepage recommendation widget. |
| Homepage Items Limit | 6 | Number of products to show on homepage. |
| Category Page Enabled | Yes | Show recommendations below category product listings. |
| Category Page Title | You May Also Like | Title above the category recommendation widget. |
| Category Items Limit | 4 | Number of products to show on category pages. |
| Product Page Enabled | Yes | Show Similar Products and Frequently Bought Together on PDP. |
| Product Page Title | Similar Products | Title above the product page recommendation widget. |
| Product Items Limit | 6 | Number of products to show on product pages. |
| Cart Page Enabled | Yes | Show Frequently Bought Together on the cart page. |
| Cart Page Title | Frequently Bought Together | Title above the cart recommendation widget. |
| Cart Items Limit | 4 | Number of products to show on cart page. |
| Checkout Page Enabled | Yes | Show "Complete Your Look" recommendations during checkout. |
| Checkout Page Title | Complete Your Look | Title above the checkout recommendation widget. |
| Checkout Items Limit | 3 | Number of products to show on checkout page. |
Placement Zones Visual
🚀 Cache Settings
Control how recommendation results are cached for performance.
Path: Stores > Configuration > MageTech > AI Recommendations > Cache Settings
| Setting | Type | Default | Purpose |
|---|---|---|---|
| Enable Recommendation Cache | Yes/No | Yes | Cache recommendation results in Redis. Disable for real-time (slower) results. |
| Cache TTL (seconds) | Number | 3600 | How long to cache results. 3600 = 1 hour. Lower = fresher but more API calls. |
| Flush AI Recommendation Cache | Button | — | Click to manually clear all cached recommendations. Use after changing config. |
⏳ Async Processing
Configure background processing for AI tasks to keep the frontend fast.
Path: Stores > Configuration > MageTech > AI Recommendations > Async Processing
| Setting | Type | Default | Purpose |
|---|---|---|---|
| Enable Message Queue | Yes/No | Yes | Process AI requests via RabbitMQ instead of synchronously. Requires RabbitMQ. |
| Enable Cron Jobs | Yes/No | Yes | Run scheduled tasks for embedding generation, cache refresh, and analytics. |
🧠 How Each Engine Works
A deep dive into what each recommendation engine does and how it generates results.
This engine generates vector embeddings for every product using OpenAI's text-embedding-3-small model. When a customer views a product, it computes cosine similarity between that product's embedding and all other product embeddings to find the most similar items.
How it works:
Analyzes historical purchase data to find products that are commonly bought in the same order. Uses frequency counting to rank products by how often they appear alongside the current product in completed orders.
Data Source:
Reads from the magetech_ai_tracking_event table where event_type = 'purchase'. Products with the highest co-occurrence frequency are recommended.
First checks if the product has Magento native cross-sell products configured. If none exist, falls back to showing random products from the same category. When AI is enabled, uses OpenAI completions to suggest contextually relevant cross-sells.
First checks if the product has Magento native upsell products configured. If none exist, suggests higher-priced products from the same category sorted by price ascending. When AI is enabled, uses OpenAI to suggest premium alternatives.
Tracks the customer's recently viewed products and finds related products from the same categories. Uses a weighted scoring system: products from multiple viewed categories get higher scores.
Builds a behavior score for each product based on the customer's interactions:
A flexible engine that adapts its recommendations based on the page context. On the homepage, it shows trending/newest products. On category pages, it shows top performers from that category. On product pages, it shows related items.
📈 Event Tracking
The extension automatically tracks user interactions to improve recommendations over time.
| Event | Trigger | Data Captured |
|---|---|---|
| product_view | Customer views a product page | Product ID, Customer ID, Session ID, Timestamp |
| add_to_cart | Customer adds item to cart | Product ID, Quantity, Customer ID, Session ID |
| purchase | Order is placed (sales_order_save_after) | Product ID, Order ID, Quantity, Price, Customer ID |
| category_view | Customer browses a category | Category ID, Category Name, Customer ID |
| impression | Recommendation widget scrolls into view | Product ID, Placement, Recommendation ID |
| click | Customer clicks a recommended product | Product ID, Recommendation ID, Placement |
✎ Prompt Templates
Customize how the AI generates recommendations by editing prompt templates.
Path: MageTech > AI Recommendations > Prompt Templates
Each engine can have a custom prompt template. The template tells the AI how to generate recommendations.
Available Variables:
Example Prompt Template:
🎨 Luma Theme Integration
The extension works out-of-the-box with the Luma theme. No configuration needed.
Layout Files:
| File | Page | Widget Added |
|---|---|---|
| cms_index_index.xml | Homepage | HomepageRecommendations block |
| catalog_category_view.xml | Category | CategoryRecommendations block |
| catalog_product_view.xml | Product | SimilarProducts + FBT blocks |
| checkout_cart_index.xml | Cart | CartRecommendations block |
| checkout_index_index.xml | Checkout | CheckoutRecommendations block |
Custom Positioning:
To move a widget to a different position, create a layout XML override in your theme:
⚡ Hyva Theme Integration
Full Hyva compatibility using Alpine.js. No KnockoutJS dependency.
The extension includes Alpine.js-powered templates that work with Hyva. Two layout options are available:
Carousel Layout
Horizontal slider with prev/next buttons. Uses Alpine.js for smooth transitions.
Grid Layout
Responsive CSS grid. Adapts from 2 columns on mobile to 4 on desktop.
Hyva Template Location:
💻 PWA Studio Integration
All recommendation data is available via GraphQL for PWA Studio storefronts.
Use the GraphQL API to fetch recommendations in your PWA components:
🔗 GraphQL API
Query recommendations and track events via GraphQL.
Get Recommendations by Placement:
Get Similar Products:
Track Event (Mutation):
🔌 REST API
RESTful endpoints for integration with external systems.
| Method | Endpoint | Description |
|---|---|---|
| GET | /V1/magetech/recommendations/:placement | Get recommendations for a placement zone |
| POST | /V1/magetech/tracking | Track a recommendation event |
Example Request:
📊 Analytics Dashboard
Monitor recommendation performance with real-time analytics.
Path: MageTech > AI Recommendations > Analytics Dashboard
Impressions
Total times recommendation widgets were displayed to customers.
Click-Through Rate (CTR)
Percentage of impressions that resulted in a product click.
Conversions
Number of purchases made from recommended products.
Revenue Impact
Estimated revenue generated from recommendation-driven purchases.
Report Pages:
| Report | Path | Data |
|---|---|---|
| CTR Report | MageTech > Analytics > CTR Report | Click-through rates by engine, placement, and time period |
| Conversion Report | MageTech > Analytics > Conversion Report | Conversion rates, revenue, and order data from recommendations |
🕑 Cron Jobs
Scheduled background tasks that keep recommendations fresh and performant.
| Cron Job | Schedule | Purpose |
|---|---|---|
| Generate Embeddings | Every 6 hours | Generates vector embeddings for new products using OpenAI. |
| Refresh Recommendations | Every 4 hours | Clears cached recommendations to pick up new data. |
| Aggregate Analytics | Every hour | Aggregates tracking events into summary analytics data. |
| Warm Cache | Every 30 minutes | Pre-generates recommendations for popular placements. |
| Cleanup Expired Data | Daily at 3 AM | Removes tracking events older than 90 days and analytics older than 180 days. |
📥 Message Queues
Asynchronous processing via RabbitMQ for AI tasks.
| Topic | Queue | Purpose |
|---|---|---|
| magetech.ai.processing | magetech_ai_processing_queue | General AI processing requests (completions, predictions). |
| magetech.ai.analytics | magetech_ai_analytics_queue | Analytics event processing and aggregation. |
| magetech.ai.embedding | magetech_ai_embedding_queue | Vector embedding generation for new/updated products. |
🔧 Troubleshooting
Recommendations not showing on frontend
bin/magento cache:flush to clear the block cache.var/log/exception.log for any AI API errors.AI API errors / timeout
platform.openai.com/settings/organization/billing.Slow page load
❓ Frequently Asked Questions
MTS AI Commerce Assistant v1.0.0 · Magento 2.4.7+ · PHP 8.2+
© 2026 MageTech Solutions. All Rights Reserved.
www.magetechsol.com ·
info@magetechsol.com