JavaScript SDK

Complete guide for integrating StatPotion with JavaScript/web games

Last updated: 12/20/2024

Installation

Add StatPotion to your JavaScript project

Basic Setup

Initialize the SDK in your game

Get your API key from the StatPotion Dashboard.

Save & Load Player Data

Store player progress across sessions

Live Configuration

Update game settings without releasing updates

Event Tracking

Monitor player behavior and game metrics

Complete Game Integration

Full example showing all features working together

Error Handling Best Practices
🔄 Network Failures

SDK automatically retries failed requests. Your game should continue working offline.

💾 Save Conflicts

When saves conflict between devices, the SDK merges data automatically where possible.

🚨 Critical Errors

Always wrap StatPotion calls in try-catch blocks and have fallback behavior ready.