Server-SideREST APIEndpoints

Retention Event

Send retention events via the webhook endpoint

The Retention Event is sent through the /webhook endpoint and tracks user sessions and retention.

Endpoint

POST /webhook

When to Call

Send a retention event:

  • On app initialization or first session of the day
  • On every app open if you want full session coverage

The SDK sends retention metrics at most once per day to avoid duplicate metrics.

Request Body

Required Fields

Prop

Type

Payload Fields

Prop

Type

Example Request

curl -X POST https://analytics.geeklab.app/webhook \
  -H "Content-Type: application/json" \
  -H "geeklab-api-key: your_api_key" \
  -d '{
    "type": "retention",
    "created_at": "2024-10-10 09:30:00",
    "creativeToken": "abc123def456",
    "device_name": "MacBook Pro",
    "device_model": "MacBookPro18,3",
    "os_system": "macOS 14.5",
    "utc_offset": "-07:00",
    "retention_day": "7",
    "payload": {
      "retentionDay": "7",
      "backfillDay": "0"
    }
  }'

Response

Successful requests return 200 OK.

Error Responses

  • 400 Bad Request: Payload is invalid
  • 401 Unauthorized: API key is missing or invalid

What's Next

Track monetization events during the user session: