RefKit Docs
Developer Integration

SDK Quickstart

Use the browser SDK to capture and apply referrals.

Embed Script

<script
  src="https://your-api-host/cdn/refkit.min.js"
  data-api-key="rk_live_xxx"
  data-track-url="https://your-api-host/track"
  data-apply-url="https://your-api-host/sdk/referrals/apply"
></script>

If data-api-key is provided, SDK auto-initializes.

Programmatic Setup

<script>
  window.RefKit.init({
    apiKey: "rk_live_xxx",
    endpoint: "https://your-api-host/track",
    applyUrl: "https://your-api-host/sdk/referrals/apply",
    autoTrackReferral: true,
  });
</script>

Track Event

window.RefKit.track("checkout_completed", {
  order_id: "ord_123",
  amount: "39.95"
});

Apply Referral

window.RefKit.applyReferral("alex-ally", {
  referredUserEmail: "new-user@example.com",
  referredUserName: "New User"
});

Built-In SDK Safety Features

  • dedupe window for repeated event payloads
  • basic rate limiting (MAX_EVENTS_PER_MINUTE)
  • referrer persistence in localStorage/cookie
  • queueing events until initialization is complete

On this page