Skip to main content

When to Use Backend APIs

Perfect for server-side tracking:
  • User registration and authentication events
  • Subscription and payment processing
  • Admin actions and system events
  • Webhook processing
  • Background job events
  • Any event that doesn’t depend on the user’s browser
Key benefits:
  • ✅ Most reliable - no client-side dependencies
  • ✅ Secure - API keys never exposed to browsers
  • ✅ Server context - automatic IP, user agent detection
  • ✅ Works with any backend language

Quick Setup (5 minutes)

1

Get your API key

  1. Sign up at userboo.st
  2. Go to SettingsAPI Keys
  3. Copy your Server-side API key (starts with ub_live_)
2

Choose your integration method

Pick the approach that fits your stack:
  • Node.js SDK
  • REST API
Recommended for Node.js applications
npm install @userboost/sdk
import { UserBoost } from "@userboost/sdk";

UserBoost.init({
  apiKey: process.env.USERBOOST_API_KEY,
  debug: process.env.NODE_ENV === "development",
});
3

Track your first event

  • Node.js SDK
  • REST API
// Track user registration
UserBoost.event("user_signed_up", {
  user: {
    id: "user_123",
    email: "john@example.com",
    traits: {
      plan: "free",
      signup_method: "email"
    }
  }
});

// Track feature usage
UserBoost.event("feature_used", {
  user: { id: "user_123" },
  properties: {
    feature: "dashboard",
    usage_count: 1
  }
});
4

Verify it's working

  1. Go to your UserBoost dashboard
  2. Navigate to EventsLive Stream
  3. Your test event should appear within 30 seconds
Enable debug mode during development to see detailed logs in your console.

Language Examples

UserBoost works with any language that can make HTTP requests. Here are quick examples:
  • Node.js
  • Python
  • Go
  • PHP
  • Ruby
// Using the official SDK (recommended)
import { UserBoost } from "@userboost/sdk";

UserBoost.init({
  apiKey: process.env.USERBOOST_API_KEY
});

// Track events anywhere in your app
UserBoost.event("user_signed_up", {
  user: {
    id: user.id,
    email: user.email,
    traits: { plan: user.plan }
  }
});

Common Event Patterns

Track these key events to build effective user journey funnels:

Authentication Events

// User registration
UserBoost.event("user_signed_up", {
  user: {
    id: user.id,
    email: user.email,
    traits: {
      plan: "free",
      signup_method: "email",
      referral_source: req.headers.referer
    }
  }
});

// Login events
UserBoost.event("user_logged_in", {
  user: { id: user.id },
  properties: {
    login_method: "password",
    ip_address: req.ip
  }
});

Onboarding Milestones

// Profile completion
UserBoost.event("profile_completed", {
  user: { id: user.id },
  properties: {
    completion_percentage: 100,
    time_to_complete: "2 minutes"
  }
});

// First key action
UserBoost.event("first_project_created", {
  user: { id: user.id },
  properties: {
    project_type: "web_app",
    days_since_signup: 1
  }
});

Subscription Events

// Subscription changes
UserBoost.event("subscription_upgraded", {
  user: { id: user.id },
  properties: {
    from_plan: "free",
    to_plan: "pro",
    annual: true,
    amount: 99
  }
});

Environment Setup

Store your API key securely using environment variables:
USERBOOST_API_KEY=ub_live_your_api_key_here
Never commit API keys to version control. Always use environment variables and add .env files to your .gitignore.

Testing & Debugging

Enable Debug Mode (Node.js SDK)

UserBoost.init({
  apiKey: process.env.USERBOOST_API_KEY,
  debug: true, // Enables detailed console logging
});

Test Event

// Send a test event to verify setup
UserBoost.event("integration_test", {
  user: { id: "test_user_" + Date.now() },
  properties: {
    test: true,
    timestamp: new Date().toISOString()
  }
});

Common Issues

Check these common causes:
  • API key format (must start with ub_live_)
  • Required user.id field is missing
  • Network connectivity issues
  • Wrong environment (test vs live keys)
Enable debug mode to see detailed error messages.
  • Verify your API key is correct
  • Ensure you’re using a server-side API key (not browser key)
  • Check that the key starts with ub_live_
  • Ensure your server can reach api.userboo.st
  • Check firewall settings
  • Verify SSL/TLS configuration

What’s Next?

Your backend integration is now ready! UserBoost will automatically start tracking your server-side events and building user journey funnels.
I