Skip to main content
Quickstart

§ 01 · Quickstart

Five-minute server-side event

Create a merchant, install the pixel, send one canonical purchase event, and verify that TrackLayer accepted it for delivery.

§ 01

Create an account.

Sign up from the public app and choose your store type. The account creates a merchant workspace, an API key store, and a default onboarding checklist.

Open signup
§ 02

Get merchant_id.

Open settings and copy the `merchant_id` from the developer panel. Use the same value in the pixel snippet and every server event.

MERCHANT ID
MERCHANT_ID=mer_01j9z4w7n2t8qx6k3ad5b9c0ef
§ 03

Install the pixel.

Add this before </head> on every storefront page. The collector stores first-party browser context, restores click IDs, and lets browser-side pixels share the same event_id as server events.

ONBOARDING STEP 02
This is the same script format used in the onboarding pixel step. Replace only `MERCHANT_ID`.
HTML
<script
  src="https://cdn.tracklayer.io/t.js"
  data-merchant-id="MERCHANT_ID"
  async>
</script>
§ 04

Send your first event.

INGESTION ENDPOINT
This checkout exposes `POST /v1/events` in the ingestion worker. If your environment also provides a browser alias such as `/v1/browser/events`, use the same payload and API key scope.
BASH
curl https://api.tracklayer.io/v1/events \
  -H "Authorization: Bearer tl_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "event_id": "ord_100045_purchase",
  "event_name": "purchase",
  "event_time": 1777039200,
  "merchant_id": "MERCHANT_ID",
  "source": "sdk",
  "source_url": "https://store.example/thank-you",
  "order_id": "100045",
  "currency": "USD",
  "value": 129.00,
  "user_data": {
    "email": "buyer@example.com",
    "phone": "+15551234567",
    "browser_ids": {
      "fbp": "fb.1.1777039000.123456789",
      "ga_client_id": "1871825471.1777039000"
    }
  },
  "items": [
    { "id": "sku_hoodie", "name": "Heavyweight Hoodie", "price": 129.00, "quantity": 1 }
  ]
}'
JAVASCRIPT
await fetch("https://api.tracklayer.io/v1/events", {
  method: "POST",
  headers: {
    Authorization: "Bearer tl_live_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "event_id": "ord_100045_purchase",
  "event_name": "purchase",
  "event_time": 1777039200,
  "merchant_id": "MERCHANT_ID",
  "source": "sdk",
  "source_url": "https://store.example/thank-you",
  "order_id": "100045",
  "currency": "USD",
  "value": 129.00,
  "user_data": {
    "email": "buyer@example.com",
    "phone": "+15551234567",
    "browser_ids": {
      "fbp": "fb.1.1777039000.123456789",
      "ga_client_id": "1871825471.1777039000"
    }
  },
  "items": [
    { "id": "sku_hoodie", "name": "Heavyweight Hoodie", "price": 129.00, "quantity": 1 }
  ]
}),
});
PYTHON
import requests

payload = {
  "event_id": "ord_100045_purchase",
  "event_name": "purchase",
  "event_time": 1777039200,
  "merchant_id": "MERCHANT_ID",
  "source": "sdk",
  "source_url": "https://store.example/thank-you",
  "order_id": "100045",
  "currency": "USD",
  "value": 129.00,
  "user_data": {
    "email": "buyer@example.com",
    "phone": "+15551234567",
    "browser_ids": {
      "fbp": "fb.1.1777039000.123456789",
      "ga_client_id": "1871825471.1777039000"
    }
  },
  "items": [
    { "id": "sku_hoodie", "name": "Heavyweight Hoodie", "price": 129.00, "quantity": 1 }
  ]
}

requests.post(
    "https://api.tracklayer.io/v1/events",
    headers={
        "Authorization": "Bearer tl_live_YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json=payload,
)
PHP
<?php
$payload = {
  "event_id": "ord_100045_purchase",
  "event_name": "purchase",
  "event_time": 1777039200,
  "merchant_id": "MERCHANT_ID",
  "source": "sdk",
  "source_url": "https://store.example/thank-you",
  "order_id": "100045",
  "currency": "USD",
  "value": 129.00,
  "user_data": {
    "email": "buyer@example.com",
    "phone": "+15551234567",
    "browser_ids": {
      "fbp": "fb.1.1777039000.123456789",
      "ga_client_id": "1871825471.1777039000"
    }
  },
  "items": [
    { "id": "sku_hoodie", "name": "Heavyweight Hoodie", "price": 129.00, "quantity": 1 }
  ]
};

$ch = curl_init("https://api.tracklayer.io/v1/events");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer tl_live_YOUR_API_KEY",
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($ch);
§ 05

Verify delivery.

01
Events

Open /events and search `ord_100045_purchase`. The row should show source `sdk`, value, order_id, and delivery status.

02
Dedup

If the browser pixel also fired, the same event_id keeps browser and server copies tied together.

03
Platforms

Open the connected destination. Meta, GA4, TikTok, and other adapters receive platform-native payloads.

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.