Quick Start Guide

Get your first event tracked in under 5 minutes.

1

Get Your API Keys

Go to Dashboard → API Keys and create a new key. You'll get two keys:

  • pk_live_...Public key. Safe for browser/client-side use.
  • sk_live_...Secret key. Server-side only. Never expose in client code.
2

Install the SDK

Choose your platform:

React / Next.js

npm install @retenshun/react
// app/layout.tsx or _app.tsx
import { RetenshunProvider } from '@retenshun/react'

export default function Layout({ children }) {
  return (
    <RetenshunProvider
      projectId="YOUR_PROJECT_ID"
      apiKey="pk_live_YOUR_PUBLIC_KEY"
    >
      {children}
    </RetenshunProvider>
  )
}

Vanilla JavaScript

<script src="https://cdn.retenshun.com/sdk/v1.js"></script>
<script>
  Retenshun.init({
    projectId: 'YOUR_PROJECT_ID',
    apiKey: 'pk_live_YOUR_PUBLIC_KEY'
  });
</script>

Server-side (Node.js, Python, etc.)

No SDK needed. Use the REST API directly:

curl -X POST https://your-domain.com/api/v1/events \
  -H "x-api-key: sk_live_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userId":"user_123","eventName":"signed_up"}'
3

Identify Users

When a user signs up or logs in, identify them so Retenshun can link their activity:

// React
const { identify } = useRetenshun()

// On login or registration
identify('user_123', {
  email: 'john@example.com',
  name: 'John Doe',
  plan: 'pro'
})
// Vanilla JS
Retenshun.identify('user_123', {
  email: 'john@example.com',
  name: 'John Doe'
})
4

Track Events

Track meaningful actions your users take:

// React
const { track } = useRetenshun()

track('purchase', { amount: 99.99, product_id: 'prod_1' })
track('feature_used', { feature: 'export' })
track('subscription_upgraded', { from: 'free', to: 'pro' })
// E-commerce (React)
const { ecommerce } = useRetenshun()

ecommerce.productViewed({ product_id: 'prod_1', price: 29.99 })
ecommerce.addedToCart({ product_id: 'prod_1', quantity: 2 })
ecommerce.orderCompleted({ order_id: 'ord_1', total: 59.98 })
5

Set Up Your First Automation

Go to Dashboard → Automations → New and create a workflow:

  1. Pick a trigger (e.g. signed_up event)
  2. Add a step: Send a welcome email
  3. Add a wait step: 3 days
  4. Add another step: Send an onboarding tips email
  5. Activate the automation

Now every new user will automatically receive your welcome sequence.

What's Next?