Custom stacks can't use Shopify/Woo plugins
Headless storefronts and bespoke commerce backends need tracking that fits their runtime, not a marketplace app that assumes a hosted checkout.
TrackLayer gives Next.js 16, Remix, Astro, and custom Rails/Django/Laravel commerce teams a stable server-side tracking layer without forcing their stack into a plugin model. It keeps headless commerce events canonical, enriched, and destination-ready across custom HTTP, theme deploy, browser, server, webhook, and edge runtimes — with full pipeline audit chain integrity.
Headless storefronts and bespoke commerce backends need tracking that fits their runtime, not a marketplace app that assumes a hosted checkout.
Analytics code glued into routes, controllers, workers, and checkout components drifts whenever teams rename fields or move business logic.
Marketing, product, and data teams lose signal quality when AddToCart, add_to_cart, and cart.added all mean the same thing in different pipelines.
Server-side JS, TypeScript, Python, and PHP SDKs for API routes, jobs, controllers, webhooks, and checkout services.
32 events with 200+ aliases mapped to canonical names before destinations receive the payload.
<20ms p99 at all Cloudflare POPs, with regional routing available for EU and US workspaces.
<2KB gzipped helper for browser events, consent forwarding, click IDs, and hydration-safe page context.
Stripe, Paddle, LemonSqueezy, and custom webhook connectors normalize commerce events without extra middleware.
Resolve anonymous sessions into signed-up customer journeys while preserving consent and deduplication state.
Run npm i @tracklayer/node or npm i @tracklayer/edge, with pip and composer packages available for Python and PHP services.
Initialize the SDK with the API key from your TrackLayer dashboard.
Call client.track({ event_name, user_data, custom_data }); TrackLayer handles enrichment and CAPI distribution.
import { TrackLayer } from "@tracklayer/node";
const client = new TrackLayer({
apiKey: process.env.TRACKLAYER_API_KEY,
});
await client.track({
event_name: "Purchase",
event_id: order.id,
user_data: {
email: order.customer.email,
phone: order.customer.phone,
fbp: cookies.get("_fbp")?.value,
},
custom_data: {
currency: order.currency,
value: order.total,
content_ids: order.items.map((item) => item.sku),
},
});import { TrackLayerEdge } from "@tracklayer/edge";
const client = new TrackLayerEdge({
apiKey: env.TRACKLAYER_API_KEY,
});
export default {
async fetch(request: Request) {
const checkout = await request.json();
await client.track({
event_name: "InitiateCheckout",
event_source_url: request.url,
user_data: checkout.user,
custom_data: checkout.cart,
});
return Response.json({ ok: true });
},
};import { track } from "@tracklayer/web";
await track({
event_name: "AddToCart",
user_data: {
external_id: window.customerId,
},
custom_data: {
content_ids: [product.sku],
currency: product.currency,
value: product.price,
},
consent: window.consentState,
});"We replaced 1400 lines of hand-rolled analytics code with 3 lines of TrackLayer SDK calls."
Founding Engineer at a headless commerce startup
Yes. The JS packages are workspace-safe, publish ESM builds, and work cleanly from pnpm, npm, yarn, and Turborepo-style monorepos.
Yes. The Node, Edge, and Web packages ship first-party TypeScript types for canonical event names, user data, custom data, consent, and destination metadata.
Use @tracklayer/edge. It avoids Node-only APIs, keeps dependencies small, and works in Vercel Edge Functions, Cloudflare Workers, and other standards-based runtimes.
Send durable commerce events from the server, then use the browser helper for page, product, and cart interactions after hydration. Shared event IDs keep deduplication intact.
Enterprise teams can run a dedicated ingestion plane with managed upgrades, private networking, and destination routing policies aligned to their compliance requirements.
HMAC-signed webhooks and SDK deploys for any stack.
Ingest, enrich, deduplicate, and fan out from one layer.
Immutable logs for compliance and forensic review.
We use essential cookies to keep the site secure and functional. Analytics and third-party tags run only with your consent. See our Cookie Policy.
We use essential cookies to keep the site secure and functional. Analytics and third-party tags run only with your consent. See our Cookie Policy.