Add cart abandonment tracking and recovery emails to any commerce website with one script.
Paste this snippet just before </body> on every page of your store.
<script async
src="https://YOUR_APP_DOMAIN/cart-recovery.js"
data-store-key="cr_PUBLIC_STORE_KEY"
data-endpoint="https://YOUR_PROJECT_REF.functions.supabase.co/functions/v1/track-event">
</script>YOUR_APP_DOMAINWhere the recovery app / script is hosted.
cr_PUBLIC_STORE_KEYPublic store key from your merchant dashboard. Safe to expose.
YOUR_PROJECT_REFYour Supabase project ref (the subdomain in your project URL).
Use the global window.cartRecovery for stores where DOM events don't capture everything.
cartRecovery.identify({
email: "shopper@example.com",
name: "Alex Shopper",
});cartRecovery.setCart({
currency: "USD",
items: [
{ id: "SKU-123", title: "Linen Shirt", price: 4900, quantity: 1 },
{ id: "SKU-456", title: "Canvas Tote", price: 2500, quantity: 2 },
],
total: 9900,
});cartRecovery.purchase({
order_id: "1042",
total: 9900,
currency: "USD",
});The backend runs entirely on Supabase Edge Functions — no servers to maintain. Each function has a single, focused responsibility.
track-eventReceives browser events from the script.
process-abandoned-cartsScheduled job that finds carts to recover.
send-recovery-emailSends recovery emails via your provider.
resend-webhookRecords deliveries, opens, and clicks.
unsubscribePublic unsubscribe endpoint linked in every email.
dashboard-apiAuthenticated API powering the merchant dashboard.
Authorization header.