Tragly Documentation

Managed server-side tracking for GA4, Facebook CAPI, TikTok, and webhooks. No servers to manage — just paste a script tag and configure your integrations.

Quick Start

  1. Sign up for a Tragly account
  2. You'll receive a tracking ID (e.g. TRG-0001)
  3. Add the tracking script to your website (see below)
  4. Configure your integrations (GA4, Facebook, etc.) in the dashboard
  5. Data starts flowing immediately
That's it. No servers to set up, no Docker, no DNS configuration. We handle all the infrastructure on our EU-hosted servers.

Add the Tracking Script

Add this snippet to your site's <head> tag. Replace the tracking ID with the one from your dashboard.

<!-- Tragly tracking script -->
<script src="https://track.tragly.com/t.js" data-id="TRG-0001" defer></script>

Or use the async loader for more control:

<script>
(function(t,r,a,g,l,y){
  t.tragly=t.tragly||function(){(t.tragly.q=t.tragly.q||[]).push([].slice.call(arguments))};
  l=r.createElement(a);y=r.getElementsByTagName(a)[0];
  l.async=1;l.src=g;y.parentNode.insertBefore(l,y)
})(window,document,'script','https://track.tragly.com/t.js');
tragly('init', 'TRG-0001');
</script>
Tip: The script is under 3KB and automatically tracks page views, scroll depth, engagement time, outbound clicks, and session starts. No extra configuration needed.

Auto-tracked events

EventTriggerParams
page_viewOn page loadpage_url, path, referrer
session_startNew session (30min timeout)new_session: true
scroll_depth25%, 50%, 75%, 100%scroll_percent
time_on_pageEvery 5 secondsengagement_time_msec
outbound_clickClick on external linkhref

Custom Events

// Track a purchase
tragly('event', 'purchase', {
  value: 49.99,
  currency: 'EUR',
  item_name: 'Pro Plan'
});

// Track a form submission
tragly('event', 'lead', {
  form_id: 'contact-form'
});

GA4 Setup

Tragly forwards your events to GA4 using the Measurement Protocol. To connect:

  1. In GA4, go to Admin → Data Streams → your stream
  2. Under Measurement Protocol API secrets, create a new secret
  3. Copy the Measurement ID (G-XXXXXXX) and API Secret
  4. Paste them into your Tragly dashboard under Integrations → GA4
Debug mode: Use the dashboard's "Test Connection" button to validate your GA4 setup before going live.

Facebook Conversions API

  1. In Facebook Events Manager, go to Settings → Conversions API
  2. Generate an access token
  3. Note your Pixel ID
  4. Enter both in your Tragly dashboard under Integrations → Facebook

Event name mapping is automatic: page_view → PageView, purchase → Purchase, add_to_cart → AddToCart, lead → Lead. User data (email, phone) is SHA-256 hashed before sending.

TikTok Events API

  1. In TikTok Ads Manager, go to Assets → Events → Web Events
  2. Create a pixel and generate an access token
  3. Enter the pixel code and token in your Tragly dashboard under Integrations → TikTok

Event mapping: page_view → ViewContent, purchase → CompletePayment, add_to_cart → AddToCart, lead → SubmitForm.

Webhooks

Forward events to any HTTP endpoint. Configure webhooks in the dashboard under Integrations → Webhooks.

Each webhook payload is signed with HMAC-SHA256. Verify the signature on your end:

const expected = crypto.createHmac('sha256', secret)
  .update(rawBody).digest('hex');
const valid = req.headers['x-tragly-signature'] === expected;

Dashboard Overview

Your dashboard shows:

Use the date range selector to filter by today, 7 days, or 30 days.

Real-Time View

The real-time view shows live data as it arrives:

Billing & Plans

PlanEvents/monthTracking IDsPrice
Starter10,0001€29/mo
Pro100,0005€79/mo
EnterpriseUnlimitedUnlimited€199/mo

Manage your subscription in the billing page. You'll see a usage bar showing how many events you've used this month. We'll notify you at 80% usage.

POST /track

Send a single event. The tracking script uses this automatically, but you can also call it from your backend for server-to-server tracking.

POST https://track.tragly.com/track
Content-Type: application/json

{
  "client_id": "user-uuid",
  "tracking_id": "TRG-0001",
  "events": [{
    "name": "purchase",
    "params": {
      "value": 49.99,
      "currency": "EUR"
    }
  }]
}

Response

{
  "ok": true,
  "received": 1,
  "forwarded": true
}

POST /track/batch

Same as /track but for sending multiple events at once. Maximum 25 events per request.

GET /collect

Pixel endpoint. Returns a 1x1 transparent GIF. Used by the tracking script as a no-JS fallback.

GET https://track.tragly.com/collect?cid=user-id&tid=TRG-0001&en=page_view

GET /api/events

List stored events. Requires authentication (Bearer token from your dashboard session).

ParamTypeDescription
fromnumberStart timestamp (ms)
tonumberEnd timestamp (ms)
eventstringFilter by event name
limitnumberMax results (default 50, max 500)

GET /api/stats

Aggregated statistics. Requires authentication.

GET https://track.tragly.com/api/stats?from=1700000000000

{
  "ok": true,
  "summary": {
    "pageviews": 1234,
    "users": 456,
    "sessions": 789,
    "avg_engagement": 3200
  }
}