Documentation/Order tracking
Order tracking
If you sell online, report each completed order to LeadReply. Analytics then shows the revenue from shoppers who chatted with your assistant before buying.
How sales are counted
- Chat sale: the shopper chatted with your assistant in the 24 hours before ordering.
- Assisted sale: they chatted 1–7 days before ordering.
- Orders from shoppers who never chatted are stored but not counted as LeadReply revenue.
Shoppers are matched by the anonymous visitor ID the widget already keeps in their browser, so nothing personal is sent. The same order reported twice is only counted once.
Tip
Shopify
Add a custom pixel once. It runs on every completed checkout.
// Shopify admin → Settings → Customer events → Add custom pixel
// Replace YOUR_WIDGET_TOKEN with the token from your LeadReply embed code.
analytics.subscribe('checkout_completed', async (event) => {
const checkout = event.data.checkout;
const visitorId = await browser.cookie.get('leadreply_visitor_id');
if (!visitorId) return; // this shopper never loaded the widget
fetch('https://leadreply.xyz/api/widget/purchase', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
keepalive: true,
body: JSON.stringify({
token: 'YOUR_WIDGET_TOKEN',
visitor_id: visitorId,
order_id: String(checkout.order?.id || checkout.token),
amount: checkout.totalPrice?.amount,
currency: checkout.currencyCode,
source: 'shopify',
}),
});
});WooCommerce
// WooCommerce: add to your theme's functions.php (or a code-snippets plugin).
add_action('woocommerce_thankyou', function ($order_id) {
$order = wc_get_order($order_id);
if (!$order) return;
printf(
"<script>(window.leadreplyQ = window.leadreplyQ || []).push(['purchase', { orderId: %s, amount: %s, currency: %s }]);</script>",
json_encode((string) $order->get_order_number(), JSON_HEX_TAG),
json_encode((float) $order->get_total(), JSON_HEX_TAG),
json_encode($order->get_currency(), JSON_HEX_TAG)
);
});Any other site
Put this on the page customers see after paying, on a page where the LeadReply widget script is installed. It works even if it runs before the widget has loaded.
<script>
// On your order-confirmation page. Replace the values with your order's.
(window.leadreplyQ = window.leadreplyQ || []).push(['purchase', {
orderId: '1001',
amount: 59.90,
currency: 'EUR'
}]);
</script>Previous
Visitor Journey
Visit-to-lead funnel, top pages, sources and each visitor’s path
Next
Plans & billing
Starter, Pro and Premium — trials, limits and changes
Questions & answers
Ask about this page — the LeadReply team and other readers can answer and upvote.
Log in to ask a question, reply, or upvote. Reading is open to everyone.
Loading discussion…