Imagine: a customer places an order, lands on the "Thank You" page, and leaves without any additional offers. On one of our projects, an electronics online store increased its average order value by 25% after integrating Flocktory, thanks to post-purchase upsell. The platform analyzes the order composition and shows a relevant partner offer — the customer gets a discount on accessories, you get a commission. Flocktory works 3 times more effectively than standard popups due to viral reach and personalization based on real purchase data. According to Flocktory, clients save up to 40% on their advertising budget.
The basic integration includes connecting the tracker on all pages, transferring order data (ID, total, composition, customer email), and setting up push-user for authorized users. Additionally, you can implement the Shaker referral program with promo codes.
Stages of Flocktory Integration with 1C-Bitrix
- Audit of the current implementation and access — we check templates, event handlers, and data output methods.
- Connecting the Flocktory tracker on all pages — inserting the code into
footer.phpor viaaddExternalJs. - Configuring the order data block on the confirmation page — correct JSON with order composition.
- Integrating push-user for authorized users — passing the email on every page.
- Implementing the referral program (promo codes) — receiving and handling referral codes in the cart.
- Testing and debugging (including debugging via
?flocktory_debug=1) — checking real orders. - Integration documentation and training for your managers.
- Warranty of correct operation after deployment: we fix bugs at our expense.
How to Connect the Flocktory Tracker in 1C-Bitrix?
The tracker is connected once on all pages of the site. In the Bitrix template — in footer.php or via addExternalJs:
<!-- Flocktory tracker --> <div class="i-flocktory" data-fl-action="track" data-fl-site-id="YOUR_SITE_ID"></div> <script type="text/javascript"> (function(w,d,n,s,t) { w[n] = w[n] || []; w[n].push(function() { t = d.createElement(s); t.type = 'text/javascript'; t.async = true; t.src = '//api.flocktory.com/v2/loader.js?site_id=<?= FLOCKTORY_SITE_ID ?>'; var sn = d.getElementsByTagName(s)[0]; sn.parentNode.insertBefore(t, sn); }); w.addEventListener('load', w[n][0]); })(window, document, '_flocktory_callbacks', 'script'); </script> FLOCKTORY_SITE_ID is a numeric identifier from the Flocktory dashboard. We recommend defining it as a constant via define in bitrix/php_interface/dbconn.php or in a settings module.
What Is Needed for Correct Order Data Transfer?
The key integration point is the "Thank You for Your Order" page. Flocktory shows the post-purchase popup only if it receives correct order data. Insert a block with data on the order success page:
<?php // In the order confirmation page template // Data is taken from the sale.order.checkout component or directly from ORDER_ID $orderId = (int)$_GET['ORDER_ID']; $order = \Bitrix\Sale\Order::load($orderId); if ($order && $order->getUserId() === $USER->GetID()) { $user = CUser::GetByID($order->getUserId())->Fetch(); $items = []; foreach ($order->getBasket()->getOrderableItems() as $item) { $items[] = [ 'id' => (string)$item->getProductId(), 'title' => $item->getField('NAME'), 'price' => (float)$item->getPrice(), 'count' => (float)$item->getQuantity(), ]; } $flData = [ 'order' => [ 'id' => (string)$orderId, 'price' => (float)$order->getPrice(), 'currency' => $order->getCurrency(), ], 'customer' => [ 'name' => trim($user['NAME'] . ' ' . $user['LAST_NAME']), 'email' => $user['EMAIL'], ], 'items' => $items, ]; ?> <div class="i-flocktory" data-fl-action="purchase" data-fl-site-id="<?= FLOCKTORY_SITE_ID ?>" data-fl-user-name="<?= htmlspecialchars($flData['customer']['name']) ?>" data-fl-user-email="<?= htmlspecialchars($flData['customer']['email']) ?>" data-fl-transaction-id="<?= $flData['order']['id'] ?>" data-fl-total-price="<?= $flData['order']['price'] ?>" data-fl-items='<?= json_encode($flData['items'], JSON_UNESCAPED_UNICODE) ?>'> </div> <?php } ?> The data-fl-items attribute must contain valid JSON. Flocktory uses this data to target the post-purchase offer: for example, if a customer bought an item from the "Electronics" category, a partner can show an offer for warranty or accessories.
Authorized User Data on All Pages
For personalization, Flocktory needs to know the email of the authorized user on any page:
<?php // In footer.php, after connecting the main tracker if ($USER->IsAuthorized()) { $currentUser = CUser::GetByID($USER->GetID())->Fetch(); ?> <div class="i-flocktory" data-fl-action="push-user" data-fl-site-id="<?= FLOCKTORY_SITE_ID ?>" data-fl-user-email="<?= htmlspecialchars($currentUser['EMAIL']) ?>" data-fl-user-name="<?= htmlspecialchars($currentUser['NAME']) ?>"> </div> <?php } ?> Integration via Bitrix Events (Alternative Approach)
Instead of HTML blocks, you can pass data via a JavaScript object after receiving confirmation from the server. The OnSaleOrderSaved event handler saves data to the session, which is then read on the "Thank You" page:
AddEventHandler('sale', 'OnSaleOrderSaved', function(\Bitrix\Main\Event $event) { $order = $event->getParameter('ENTITY'); $isNew = $event->getParameter('IS_NEW'); if (!$isNew) return; $_SESSION['FLOCKTORY_ORDER'] = [ 'id' => $order->getId(), 'price' => $order->getPrice(), ]; }); This method is convenient if you need to avoid changes in templates. More about the OnSaleOrderSaved event — 1C-Bitrix documentation.
Why Might Flocktory Not Show the Popup?
| Problem | Cause | Solution |
|---|---|---|
| Popup not showing | Empty or invalid email | Check that the customer's email is correct and passed in data-fl-user-email |
| Popup not showing | Invalid JSON in data-fl-items |
Use json_encode() and escape quotes |
| Tracker not loading | Incorrect site_id | Verify site_id in the Flocktory dashboard and constant |
| Push-user not working | User not authorized | Ensure the push-user block is rendered for authorized users |
| Referral link not working | Promo code not applied | Check promo code handling logic in the cart |
Budget savings on customer acquisition with Flocktory can reach 40%. The integration pays for itself in an average of 3 months.
What Is Included in the Work
- Full audit of the current implementation and site access.
- Connecting the Flocktory tracker on all pages.
- Configuring order data transfer on the confirmation page.
- Integrating push-user for authorized users.
- Implementing a referral program with promo codes (optional).
- Testing and debugging all mechanics.
- Integration documentation and training for your managers.
- Warranty of correct operation after deployment.
Implementation Timelines
| Scope | Composition | Time |
|---|---|---|
| Basic (tracker + post-purchase popup) | Data block on order page + tracker | 0.5–1 day |
| With push-user on all pages | + authorization on every page | +0.5 day |
| Referral program (promo codes) | + handling referral links + discounts | 2–3 days |
Get a consultation from an engineer — contact us to clarify the details of your project and estimate the cost of turnkey integration. Order on-site setup or remote assistance.







