Back to home

Documentation

Get started with Argus in under 5 minutes. Track commands, errors, servers, and revenue.

Installation

Install the SDK via npm. Works with Node.js 16+ and any Discord library (discord.js, eris, etc).

npm install argus-discord-analytics

Quick Start

Initialize Argus with your API key and start tracking commands. That's literally it.

const { Argus } = require('argus-discord-analytics');

// Initialize with your API key
const argus = new Argus({
  apiKey: 'arg_live_your_api_key_here',
});

// That's it! Now track your commands:
client.on('interactionCreate', (interaction) => {
  if (!interaction.isCommand()) return;
  
  argus.trackCommand(interaction.commandName, {
    serverId: interaction.guildId,
    userId: interaction.user.id,
  });
  
  // ... handle your command
});

Note: Argus tracks events from the moment you integrate the SDK forward. There's no retroactive data — your dashboard will start at zero and grow as your bot receives commands.

SDK Methods

trackCommand()

Track slash commands or message commands. Pass the command name and optional context.

// Track a command
argus.trackCommand('play', {
  serverId: interaction.guildId,
  userId: interaction.user.id,
});

// Or use the auto-tracker with Discord.js interactions
argus.track(interaction); // Automatically extracts command name, server, user

trackError()

Capture errors with full stack traces. Link errors to specific commands for easier debugging.

// Track errors with context
try {
  await riskyOperation();
} catch (error) {
  argus.trackError(error, {
    command: 'play',
    serverId: interaction.guildId,
    userId: interaction.user.id,
  });
}

trackServer()

Monitor your bot's server growth. Sync existing servers on startup, then track joins and leaves automatically.

// On startup: sync all existing servers
client.once('ready', () => {
  client.guilds.cache.forEach(guild => {
    argus.trackServer('join', {
      serverId: guild.id,
      memberCount: guild.memberCount,
    });
  });
});

// Track when bot joins a new server
client.on('guildCreate', (guild) => {
  argus.trackServer('join', {
    serverId: guild.id,
    memberCount: guild.memberCount,
  });
});

// Track when bot leaves/is kicked
client.on('guildDelete', (guild) => {
  argus.trackServer('leave', {
    serverId: guild.id,
  });
});

trackRevenue()

Track revenue from Patreon, Ko-fi, Stripe, or any custom source. All amounts in cents.

// Track Patreon pledges
argus.trackRevenue({
  source: 'patreon',
  amount: 500,  // $5.00 in cents
  tier: 'Premium',
  userId: 'discord_user_id', // optional
});

// Track Ko-fi donations
argus.trackRevenue({
  source: 'kofi',
  amount: 300,
  currency: 'USD',
});

startHeartbeat()

Enable uptime monitoring. Argus will alert you if your bot goes offline.

// Start uptime monitoring when bot is ready
client.once('ready', () => {
  console.log('Bot is online!');
  
  // Send heartbeat every 30 seconds (default)
  argus.startHeartbeat();
  
  // Or customize the interval
  // argus.startHeartbeat({ interval: 60000 }); // 1 minute
});

// Stop heartbeat on shutdown
process.on('SIGINT', async () => {
  argus.stopHeartbeat();
  await argus.shutdown();
  process.exit(0);
});

startTimer() / endTimer()

Measure command execution time. Track which commands are slowest.

// Track command execution time
client.on('interactionCreate', async (interaction) => {
  // Start timer
  const timerId = argus.startTimer(interaction.id);
  
  try {
    await handleCommand(interaction);
  } finally {
    // End timer and track with latency
    argus.endTimer(timerId, interaction);
  }
});

Configuration Options

Customize batching, flushing, privacy settings, and more.

// Full configuration options
const argus = new Argus({
  apiKey: 'arg_live_xxx',      // Required
  debug: true,                  // Log SDK activity (default: false)
  batchSize: 10,               // Events before auto-flush (default: 10)
  flushInterval: 10000,        // Auto-flush interval ms (default: 10000)
  hashUserIds: true,           // Hash user IDs CLIENT-SIDE before sending (default: true)
  heartbeatInterval: 30000,    // Heartbeat interval ms (default: 30000)
});

// Privacy note: When hashUserIds is true (default), user IDs are hashed
// IN YOUR BOT before data reaches Argus servers. We never see raw IDs.
// Set to false only if you want to identify specific users in your dashboard.

Pricing & What Counts as an Event

Your plan is based on events per month. Here's what actually counts:

✓ Counts toward limit

  • trackCommand() — every command your bot receives
  • trackError() — errors you capture
  • trackCustomEvent() — any custom events

✗ Free, doesn't count

  • startHeartbeat() — uptime pings (runs every 30s)
  • trackServer() — server joins/leaves
  • trackRevenue() — revenue tracking
PlanEvents/moMAUBotsPrice
Free10,0001,0001$0
Pro100,00010,0003$19/mo
Team500,00050,00010$49/mo
Scale2,000,000200,000$99/mo

How limits work: Your plan has two limits — events and MAU (monthly active users). Exceed either one and you'll need to upgrade.

This prevents gaming via sampling. You can't fake unique users — they either used your bot or they didn't.

REST API (Any Language)

Not using JavaScript? No problem. Hit our REST API directly from Python, Go, Rust, or any language.

# REST API - Works with any language!
# Just POST events to our API:

curl -X POST https://www.tryargus.io/api/events \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer arg_live_your_key" \
  -d '{
    "events": [{
      "type": "command",
      "name": "play",
      "serverId": "123456789",
      "userHash": "abc123"
    }]
  }'

Need help?

Join our Discord server for support, feature requests, or just to chat with other bot developers.