1C-Bitrix Integration with Mindbox
Mindbox is a CDP platform for marketing automation aimed at mid-sized and large retailers. It consolidates data from all channels (website, mobile app, offline, call centre), builds a unified customer profile, and manages personalised communications. The platform is priced for businesses with substantial annual revenue.
Integration Architecture
Mindbox operates through two mechanisms:
- JavaScript SDK (Mindbox.js) — real-time tracking of user actions on the site: page views, add-to-cart events, logins.
- Server-side API (v3) — transmission of transactional data: orders, registrations, profile updates.
Both mechanisms must use a shared customer identifier (deviceUUID for anonymous users, customerId for authenticated ones).
Connecting the JavaScript SDK
In the 1C-Bitrix template (header.php or a component):
<script>
window.mindbox = window.mindbox || function() { mindbox.queue.push(arguments); };
mindbox.queue = mindbox.queue || [];
</script>
<script async src="//cdn.mindbox.ru/scripts/v1/tracker.js"></script>
<script>
mindbox('create', {
endpointId: '<?= COption::GetOptionString("site","mindbox_endpoint_id") ?>',
});
// Pass the authenticated user ID
<?php if ($USER->IsAuthorized()): ?>
mindbox('identify', {
operation: 'SiteVisit',
data: {
customer: {
ids: { websiteId: '<?= $USER->GetID() ?>' },
},
},
});
<?php endif; ?>
</script>
Sending an Order via the Server-side API
class MindboxClient {
private string $secretKey;
private string $endpointId;
public function sendOrder(\Bitrix\Sale\Order $order): void {
$basket = $order->getBasket();
$props = $order->getPropertyCollection();
$lines = [];
foreach ($basket as $item) {
$lines[] = [
'product' => ['ids' => ['websiteId' => (string)$item->getProductId()]],
'quantity' => $item->getQuantity(),
'priceOfLine' => $item->getPrice() * $item->getQuantity(),
'discountOfLine' => 0,
];
}
$payload = [
'order' => [
'ids' => ['websiteId' => (string)$order->getId()],
'totalPrice' => $order->getPrice(),
'lines' => $lines,
'customer' => [
'ids' => ['websiteId' => (string)$order->getUserId()],
'email' => $props->getUserEmail(),
'mobilePhone' => $props->getItemByOrderPropertyCode('PHONE')?->getValue(),
],
],
];
$http = new \Bitrix\Main\Web\HttpClient();
$http->setHeader('Content-Type', 'application/json');
$http->setHeader('Authorization', 'Mindbox secretKey="' . $this->secretKey . '"');
$http->post(
"https://api.mindbox.ru/v3/operations/sync?endpointId={$this->endpointId}&operation=Website.CreateOrder",
json_encode($payload)
);
}
}
Operations
Every interaction in Mindbox is an "operation" with a unique name. Operation names are created in the Mindbox dashboard and passed in the operation parameter:
| Operation | 1C-Bitrix Event |
|---|---|
Website.CreateOrder |
OnSaleOrderSaved (new order) |
Website.UpdateOrder |
OnSaleOrderSaved (status change) |
Website.Register |
OnAfterUserRegister |
Website.UpdateProfile |
OnAfterUserUpdate |
Website.SetCart |
OnSaleBasketSaved |
Website.SubscribeEmail |
OnSubscribeSubscribe |
Loyalty Programme
Mindbox includes a built-in loyalty programme module. Once connected, points are awarded for purchases and redeemed at checkout. A "Use points" field is added to the order form:
// Get customer point balance
public function getCustomerBalance(int $userId): float {
$response = $this->callSync('Website.GetCustomerBalance', [
'customer' => ['ids' => ['websiteId' => (string)$userId]],
]);
return $response['customer']['bonusPoints']['available'] ?? 0;
}
When points are successfully redeemed, the discount is applied to the order via CSaleBasket::UpdatePrice().
Case Study: Unified Customer Profile
A cosmetics retail chain: online store on 1C-Bitrix + offline POS terminals + mobile app. Before Mindbox — three separate customer databases; marketers had no complete picture.
After integrating Mindbox, profiles were merged by phone number and email. A customer who made an offline purchase receives a "similar products" email based on their receipt rather than a generic newsletter. Retention rate increased by 12% over six months.
| Task | Effort |
|---|---|
| JS SDK setup + page view tracking | 4–6 h |
| Server-side API: orders and profiles | 8–12 h |
| Loyalty programme integration | 8–16 h |
| Offline data synchronisation | project-dependent |







