Usage Tracking Demo

This demo shows how to track usage events with Usagey. Fill out the form below to send a usage event.

Track Usage Event

Metadata (Optional)

Result

Submit the form to see the result

How It Works

This demo uses the Usagey SDK to track usage events. The implementation follows these steps:

  1. Import the trackEvent function from our client library
  2. Collect event details through a form (event type, quantity, metadata)
  3. Call trackEvent() with the provided parameters
  4. Display the API response, which includes confirmation and usage statistics

Code Example

import { trackEvent } from '@/lib/usagey-client';

// Track a usage event
const result = await trackEvent(
  'api_call',   // Event type
  1,            // Quantity
  {             // Metadata (optional)
    endpoint: '/users',
    method: 'GET' 
  }
);