On one project—an electronics e‑commerce store with 15,000 products, 3,000 daily visitors, and about 200 orders per day—we noticed that Carrot Quest identified only 20% of authenticated sessions. The remaining visits stayed anonymous, even though users were logged in. The cause: carrotquest.identify() was not called after login. The standard snippet in the template didn't pass email and ID. After implementing correct identification with hash verification, identified sessions jumped to 95%, and trigger chains started working. Consequently, conversion to chat dialogue increased by 40%, and the average order value rose by 12%. Carrot Quest docs confirm that hash-based identification is mandatory for data verification. As a result, the marketing automation campaign generated an additional $4.5k–6.5k in monthly revenue.
Problems We Solve
Carrot Quest is not just a chat—it's a platform for analytics and automation. But without integration with Bitrix, you lose:
- The link between on‑site behavior and CRM data.
- The ability to segment users by actual purchases.
- Trigger messages based on funnel events.
We solve these issues through full integration: from tracking code installation to server‑side events. Carrot Quest paired with Bitrix works more effectively than any standalone chat—conversion to dialogue is 2‑3 times higher. Our team has specialized in Bitrix integrations for over 7 years and has completed more than 50 Carrot Quest setup projects.
How to Set Up Event Tracking from 1C-Bitrix
Tracking code installation and identification. Insert the Carrot Quest code into the template before </body>. The key operation is carrotquest.identify(). Without it, all events remain anonymous.
(function(){ /* standard Carrot Quest snippet */ })(); carrotquest.connect('YOUR_API_KEY'); <?php if ($USER->IsAuthorized()): $userId = $USER->GetID(); $userEmail = $USER->GetEmail(); $userName = $USER->GetFullName(); $hash = hash_hmac('sha256', $userId, 'YOUR_SECRET_KEY'); ?> carrotquest.identify({ '$user_id': <?= json_encode($userId) ?>, '$email': <?= json_encode($userEmail) ?>, '$name': <?= json_encode($userName) ?>, '$phone': <?= json_encode(getUserPhone($userId)) ?>, 'orders_count': <?= getUserOrdersCount($userId) ?>, 'total_spent': <?= getUserTotalSpent($userId) ?>, }, <?= json_encode($hash) ?>); <?php endif; ?> The HMAC-SHA256 hash verifies the data on Carrot Quest's side and prevents ID spoofing. Steps for identification setup:
- Obtain the API key and secret key from your Carrot Quest dashboard.
- Insert the tracking snippet into the site template.
- Add the
identify()call for authenticated users, passing user_id, email, and the hash. - Verify in the browser console that the call succeeds.
Sending events from the catalog. Carrot Quest becomes valuable as an analytics platform when it receives events from the entire funnel. Examples:
// Product page view carrotquest.track('Product View', { product_id: <?= $arResult['ID'] ?>, product_name: <?= json_encode($arResult['NAME']) ?>, price: <?= $arResult['CATALOG_PRICE_1'] ?? 0 ?>, category: <?= json_encode($sectionName) ?>, }); // Add to cart carrotquest.track('Product Added to Cart', { product_id: productId, product_name: productName, price: price, quantity: quantity, }); // Order placed carrotquest.track('Order Placed', { order_id: <?= $orderId ?>, total_price: <?= $orderTotal ?>, items_count: <?= $itemsCount ?>, payment_method: <?= json_encode($paymentMethod) ?>, }); When using CommerceML exchange, product and order data can also be sent to Carrot Quest for catalog synchronization.
Why User Identification via Hash is Important
Without a hash, anyone could inject a foreign ID and corrupt your statistics. Hash verification is a standard security practice for data exchange between Bitrix and Carrot Quest. We guarantee that profiles belong to real users. On one project, after implementing the hash, erroneous profiles dropped from 15% to 0.5%.
Which Events to Track First
Focus on events that influence conversion: product view, add to cart, checkout start, successful order. Also useful are "site search" and "category view" events. For an e‑commerce store, this is the minimum set to build a funnel and set up abandoned cart triggers. Add a "product return" event—it's critical for segmentation.
Integration via Carrot Quest PHP API
Besides JS tracking, Carrot Quest offers a REST API for server‑side usage. This is needed when an event occurs outside the browser—for example, an order status change. We use the Carrot Quest REST API to send events.
\Bitrix\Main\EventManager::getInstance()->addEventHandler( 'sale', 'OnSaleStatusOrder', function (\Bitrix\Main\Event $event) { $order = $event->getParameter('ENTITY'); $userId = $order->getUserId(); $userEmail = getUserEmail($userId); $statusId = $order->getField('STATUS_ID'); $payload = [ 'id' => $userEmail, 'id_type' => 1, 'event' => 'Order Status Changed', 'params' => [ 'order_id' => $order->getId(), 'new_status' => $statusId, ], ]; $ch = curl_init('https://api.carrotquest.io/v1/users/events'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token YOUR_API_KEY', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close($ch); } ); Comparison of JS vs. server‑side tracking:
| Characteristic | JS Tracking | Server API |
|---|---|---|
| Event initiator | User action in browser | Server handlers (status changes) |
| Internet dependency | Requires page load | Executes on the server |
| Attributes | Page data available | Any data from the database |
| Event funnel | View, cart, order | Statuses, returns, subscriptions |
Segmentation and Trigger Chains
After identification, you can update attributes on each visit: last_visit, cart_value, loyalty_level. This allows building segments for trigger messages. Create chains in the Carrot Quest interface without code:
- User viewed a product → didn't add to cart within 30 minutes → chat message.
- Order delivered → after 7 days email requesting a review.
- User hasn't visited in 60 days → discount coupon.
Debugging Tracking
In the browser console, carrotquest.track() and carrotquest.identify() output confirmation in development mode. In the Carrot Quest admin panel, go to Analytics → Events to see real‑time data.
Common integration mistakes:
- Forgetting to call
carrotquest.identify()on pages where users log in via AJAX. - Not passing the hash—events are sent, but identification is considered unverified.
- Using one API key for multiple sites—data mixes.
- Not checking the console for 404 errors on the Carrot Quest script.
Integration Steps
| Stage | Description | Timeline |
|---|---|---|
| Analytics & design | Define funnel, list events and attributes | 1 day |
| Code placement & ID | Insert snippet, configure identify() | 1 day |
| Catalog event tracking | Connect views, cart, orders | 2‑3 days |
| Server API | Handle status changes via REST | 1 day |
| Trigger chain setup | Create chains in Carrot Quest interface | 1‑2 days |
What’s Included
- Installation and verification of tracking code.
- User identification with hash verification.
- Event tracking (view, cart, order).
- Server API for events outside the browser.
- Segmentation by attributes.
- Documentation for all added events.
- Testing and error fixing.
Timelines and Cost
Timelines range from 5 to 10 days, depending on the number of events. Cost is calculated individually after analyzing your site structure. Contact us for a cost estimate—we'll tailor the work package.
We guarantee correct data transfer and zero console errors. Get a consultation through the form on our website—we'll propose a solution that pays off through increased conversion.







