Skip to main content
SOLUTION / CUSTOM STORE

For the stores the app-store plugins don't cover

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.

checkout.completedNext.js APIcaptured
payment_succeededStripe webhookmapped
cart.addedBrowser helperdeduped
purchaseMeta CAPIaccepted
CUSTOM STORE SIGNAL PIPELINE
§ 01

Why custom stores need this

01

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.

02

Hand-rolled tracking breaks on every refactor

Analytics code glued into routes, controllers, workers, and checkout components drifts whenever teams rename fields or move business logic.

03

Event taxonomies drift when each team invents their own

Marketing, product, and data teams lose signal quality when AddToCart, add_to_cart, and cart.added all mean the same thing in different pipelines.

§ 02

What TrackLayer gives you

01

REST + server SDKs

Server-side JS, TypeScript, Python, and PHP SDKs for API routes, jobs, controllers, webhooks, and checkout services.

02

Canonical event taxonomy

32 events with 200+ aliases mapped to canonical names before destinations receive the payload.

03

Edge-deployed ingestion

<20ms p99 at all Cloudflare POPs, with regional routing available for EU and US workspaces.

04

Client-side helper

<2KB gzipped helper for browser events, consent forwarding, click IDs, and hydration-safe page context.

05

Webhook connectors

Stripe, Paddle, LemonSqueezy, and custom webhook connectors normalize commerce events without extra middleware.

06

Identity resolution

Resolve anonymous sessions into signed-up customer journeys while preserving consent and deduplication state.

§ 03

Installation in 3 steps

01

Run npm i @tracklayer/node or npm i @tracklayer/edge, with pip and composer packages available for Python and PHP services.

02

Initialize the SDK with the API key from your TrackLayer dashboard.

03

Call client.track({ event_name, user_data, custom_data }); TrackLayer handles enrichment and CAPI distribution.

§ 04

SDK examples

Node.js server
Edge runtime
Client-side browser
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,
});
§ 05

Why not just call CAPI directly?

Capability
Direct CAPI
TrackLayer
Dedup via event_id+fbp
automatic
Platform schema drift handling
manual
handled
Retries + DLQ
none
built-in
Match quality monitoring
none
dashboard
§ 06

Builder proof

"We replaced 1400 lines of hand-rolled analytics code with 3 lines of TrackLayer SDK calls."

Founding Engineer at a headless commerce startup

§ 07

FAQ

Monorepo and pnpm support?

Yes. The JS packages are workspace-safe, publish ESM builds, and work cleanly from pnpm, npm, yarn, and Turborepo-style monorepos.

Do the SDKs include TypeScript types?

Yes. The Node, Edge, and Web packages ship first-party TypeScript types for canonical event names, user data, custom data, consent, and destination metadata.

What about edge runtime constraints like no fs or child_process?

Use @tracklayer/edge. It avoids Node-only APIs, keeps dependencies small, and works in Vercel Edge Functions, Cloudflare Workers, and other standards-based runtimes.

How does this work with server-side rendering and client hydration?

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.

Is there a self-hosted option?

Enterprise teams can run a dedicated ingestion plane with managed upgrades, private networking, and destination routing policies aligned to their compliance requirements.

§ 08

Built for Custom Store

01

Custom HTTP / theme deploy

HMAC-signed webhooks and SDK deploys for any stack.

02

Full pipeline

Ingest, enrich, deduplicate, and fan out from one layer.

03

Audit chain integrity

Immutable logs for compliance and forensic review.

READY FOR CUSTOM COMMERCE ATTRIBUTION

Wire the SDK once, then let TrackLayer keep every destination in shape.

Read the docs →Start free trial →

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.