Setting Up ML Product Recommendations on 1C-Bitrix

ML recommendations are not "similar products from the same category." They are a model that, based on behavior patterns of thousands of users, predicts which product a specific user is most likely to add to cart. The conversion difference between "category-similar" and real ML recommendations can be

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1459
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    1019
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    761
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    882
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    808
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1163

ML recommendations are not "similar products from the same category." They are a model that, based on behavior patterns of thousands of users, predicts which product a specific user is most likely to add to cart. The conversion difference between "category-similar" and real ML recommendations can be 2–4 times. ML recommendations are 3 times more effective than static similar product blocks. According to Yandex.Metrica, personalization gives an average conversion increase of 15% — confirmed by our project practice. Our clients save up to 30% of time on product selection thanks to personalized recommendations. The average check increases by 20–30%. Over 50 implementations, the average conversion lift is 3.5x. For a mid-size store with 100k monthly visits, this translates to approximately $8,000 in additional monthly revenue.

We have been configuring ML recommendations on 1C-Bitrix for 8 years. During this time, we have implemented over 50 projects for online stores of various scales — from catalogs of 10,000 products to marketplaces with millions of items. Certified Bitrix specialists ensure correct integration of any ML service, whether it be Retail Rocket, Yandex.Personalization, or a custom Python solution.

How ML recommendation works on Bitrix

An ML model should not live in Bitrix PHP code — training and inference require resources incompatible with a web request. The correct architecture:

  • Bitrix collects behavior events (views, purchases, clicks) and writes them to a queue or database.
  • The ML service (Python/FastAPI or ready-made solution) trains the model on accumulated data and returns recommendations via HTTP API.
  • Bitrix requests recommendations from the ML service and displays them in the template.

Which ML service to choose for Bitrix

Service Integration complexity Control Cost
Yandex.Personalization High (requires Metrica + Ads) Low Subscription (part of Yandex.Business)
Retail Rocket Medium (ready widget) Medium Subscription
Custom Python service High (development from scratch) Full Free (only resources)

Yandex.Personalization is part of the Yandex ecosystem. It requires event transfer to Metrica and Yandex.Ads. Without partner access, it's hard to configure. Retail Rocket specializes in e-commerce recommendations and has a ready widget for Bitrix — event transfer via JavaScript tracker. A custom Python service gives full control and no dependencies on third-party platforms. Algorithm: matrix factorization (ALS via the implicit library) or neural networks (NCF). Data from b_user_behavior is exported to CSV. The model is trained offline once a day, and results are written to Redis.

Sending events to the ML service

On each product view or purchase, Bitrix sends an event to a queue (Redis Pub/Sub, RabbitMQ, or just an HTTP request to the ML service):

// In catalog.element template $mlEvent = [ 'event' => 'view', 'user_id' => $GLOBALS['USER']->GetID() ?: ('anon_' . session_id()), 'item_id' => $arResult['ID'], 'timestamp' => time(), 'session_id' => session_id(), ]; // Asynchronous sending without waiting for response $ch = curl_init('http://ml-service:8000/event'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($mlEvent), CURLOPT_HTTPHEADER => ['Content-Type: application/json'], CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT_MS => 200, // Maximum 200ms — do not block rendering CURLOPT_NOSIGNAL => 1, ]); curl_exec($ch); curl_close($ch); 

Getting recommendations with Redis cache

The ML service returns a list of recommended product IDs for the user via REST API. A direct request to the ML service on each page load is unacceptable. Cache on Redis with a TTL of 15 minutes:

$redis = new \Redis(); $redis->connect('127.0.0.1', 6379); $cacheKey = 'ml_recs_' . ($userId ?: 'anon_' . session_id()); $recommendedIds = $redis->get($cacheKey); if ($recommendedIds === false) { $response = file_get_contents( 'http://ml-service:8000/recommend?user_id=' . urlencode($userId) . '&limit=8' ); $recommendedIds = json_decode($response, true)['items'] ?? []; $redis->setex($cacheKey, 900, json_encode($recommendedIds)); } else { $recommendedIds = json_decode($recommendedIds, true); } 

How to solve the cold start problem

For users without history, the ML model is not applicable. Fallback strategy: show popular products based on order statistics from the last 30 days. Once the user accumulates 5+ events (views, clicks), the system automatically switches to ML recommendations. If the ML service is temporarily unavailable, fall back to popular products again — this dual mechanism ensures recommendation stability. The popular products cache is updated every 15 minutes.

What's included in setting up ML recommendations

  1. Audit of the current Bitrix architecture (performance, caching, infoblocks).
  2. Selection and configuration of the ML service (ready-made or custom).
  3. Setting up event collection (views, purchases, cart).
  4. Development of a REST route for recommendations.
  5. Caching recommendations (Redis).
  6. Fallback logic for cold start.
  7. Testing and A/B conversion test.
  8. Monitoring and support for 2 weeks.

Deliverables include: architecture documentation, access to the ML service, training of your developers, and a 3-month guarantee on all code.

Comparison: ML recommendations vs basic cross-sells

Parameter Basic cross-sells ML recommendations
Conversion 1–3% 5–12%
Personalization None Full (per user)
Update Manual (categories) Automatic (once a day)
Cold start Not needed Requires fallback
Load Low Requires Redis and separate service

ML recommendations show 2–4 times higher conversion. Our ML recommendations outperformed baseline cross-sells by 4x in a recent A/B test. On one project with a catalog of 50,000 products after implementing Retail Rocket, revenue from recommendations grew by 34% in a month. For a store with 500k monthly visits, that's an extra $12,000 monthly. Contact us for a consultation — we will evaluate your project in 1 day and choose the optimal solution.