Godot SDK Setup Guide

Complete setup guide for integrating Tokebi analytics into your Godot Engine projects.
One-click installer, AutoLoad configuration, and event tracking examples for indie developers.
๐ Quick Setup Overview
Get analytics running in under 5 minutes! The Tokebi Godot SDK provides everything you need.
1. Download
One-click installer
2. Install
Run in Script Editor
3. Track
Start tracking events
๐ฆ Step 1: Download & Installation
๐ฅ Download the Installer
Get the Tokebi Installer
Download our one-click installer that automatically sets up the entire SDK for you.
๐ฅ Download Godot InstallerWhat's Included
- โข Complete Tokebi SDK for Godot
- โข Plugin configuration files
- โข Setup dialog with API key input
- โข AutoLoad script generation
- โข Multiplayer support
- โข Error handling and logging
๐ง Installation Steps
Extract and Add to Project
Extract the downloaded file and copy install_tokebi.gd
into your Godot project root.
# Your project structure: res:// โโโ install_tokebi.gd โ Add this file here โโโ project.godot โโโ scenes/
Run the Installer
Open the installer in Godot's Script Editor and run it.
๐ Important: Make sure to open install_tokebi.gd
in the Script Editor, then press Ctrl+Shift+X or use Script โ Run to execute the installer.
Enable the Plugin
Go to Project Settings โ Plugins and enable "Tokebi Analytics SDK".
Project Settings โ Plugins โ Enable "Tokebi Analytics SDK"
โ๏ธ Step 2: Configuration
๐ API Key Setup
Tokebi Setup Dock
After enabling the plugin, you'll see a "Tokebi Setup" dock in the editor.
โ Plugin enabled successfully!
Look for the "Tokebi Setup" dock on the left side of the editor.
Enter Your Credentials
Game Name: Auto-detected from project settings
ProjectSettings.get_setting("application/config/name")
API Key: From your Tokebi dashboard
f28c6329-4aff-4c1a-8917-a66c59db5da4
๐ AutoLoad Setup
Automatic Generation
The installer creates tokebi.gd
with your API key and game settings.
# tokebi.gd (automatically generated) extends Node const API_KEY = "your-api-key-here" const ENDPOINT = "https://tokebi-api.vercel.app" var game_name: String = "" var game_id: String = "" var player_id: String = "" func _ready(): game_name = ProjectSettings.get_setting( "application/config/name", "Unnamed Godot Game" ) _init_tokebi()
Add to AutoLoad
Manually add the generated SDK to your project's AutoLoad:
- 1. Go to Project Settings โ AutoLoad
- 2. Click the "+" button
- 3. Set Name:
Tokebi
- 4. Set Path:
res://tokebi.gd
- 5. Click "Add"
๐ Step 3: Basic Usage
๐ฏ Basic Tracking Syntax
# Basic syntax Tokebi.track(event_type: String, payload: Dictionary = {}) # Simple examples Tokebi.track("game_started") Tokebi.track("level_completed", {"level": 1, "time": 45.2}) Tokebi.track("item_collected", {"item": "sword", "rarity": "epic"}) # The SDK automatically handles: # - Player ID generation and persistence # - Game ID from registration # - Timestamps and platform info # - Multiplayer mode detection
event_type
String describing what happened (your choice!)
payload
Dictionary with event-specific data (optional)
๐ฎ Practical Examples
๐ Game Flow Events
Game Started
# In your main scene's _ready() func _ready(): Tokebi.track("game_started", { "game_mode": "single_player", "difficulty": "normal", "version": "1.2.3" })
Level Completed
# When player finishes a level func complete_level(level_num: int, time_taken: float): Tokebi.track("level_completed", { "level": level_num, "completion_time": time_taken, "score": player_score, "deaths": death_count, "collectibles": items_collected })
๐ค Player Events
Player Death
# In your player script func _on_player_died(): Tokebi.track("player_died", { "cause": "enemy_attack", "location": current_area, "level": player_level, "health_remaining": 0, "enemy_type": "goblin" })
Item Collected
# When player picks up an item func collect_item(item_name: String, item_type: String): Tokebi.track("item_collected", { "item_name": item_name, "item_type": item_type, "inventory_count": get_inventory_count(), "location": get_current_area(), "method": "pickup" })
๐ง System Events
Settings Changed
# In your settings menu func _on_setting_changed(setting: String, value): Tokebi.track("setting_changed", { "setting_name": setting, "new_value": str(value), "changed_from": "settings_menu" })
Error Occurred
# For error tracking func log_error(error_message: String, context: String): Tokebi.track("error_occurred", { "error_message": error_message, "context": context, "platform": OS.get_name(), "engine_version": Engine.get_version_info() })
๐ฐ Economy Events
Purchase Made
# In your shop system func purchase_item(item: String, cost: int, currency: String): Tokebi.track("item_purchased", { "item_name": item, "cost": cost, "currency_type": currency, "shop_category": "weapons", "balance_before": get_currency_amount(currency), "balance_after": get_currency_amount(currency) - cost })
Currency Earned
# When player earns currency func earn_currency(amount: int, source: String): Tokebi.track("currency_earned", { "amount": amount, "currency_type": "coins", "source": source, "total_balance": get_total_coins(), "earning_method": "quest_reward" })
๐ Multiplayer Considerations
๐ฏ Smart Multiplayer Handling
The Tokebi SDK automatically detects multiplayer modes and prevents duplicate events from multiple clients.
Single Player
All events tracked normally
Multiplayer Host
Tracks all game events
Multiplayer Client
Blocked by default (configurable)
โ Automatic Detection
# The SDK automatically detects: func _detect_multiplayer_mode(): if not multiplayer.has_multiplayer_peer(): return "Single Player" elif multiplayer.is_server(): return "Multiplayer Host/Server" else: return "Multiplayer Client" # Events are automatically filtered: # - Host/Server: โ Tracks events # - Client: โ Blocks events (prevents duplicates)
๐ง Force Client Events
# For client-specific events (UI, local actions) func _on_ui_button_clicked(): Tokebi.track_client_event("ui_interaction", { "button": "inventory", "screen": "main_menu" }) # Or use force parameter func _on_local_event(): Tokebi.track("local_action", { "action": "screenshot_taken" }, true) # force_track = true
โญ Godot SDK Best Practices
โ Do This
- โข Call
Tokebi.track()
from any script after AutoLoad setup - โข Use descriptive event names like
"boss_defeated"
- โข Include context in payload (location, difficulty, time)
- โข Track both success and failure events
- โข Use consistent naming conventions (snake_case)
- โข Let the SDK handle multiplayer automatically
- โข Track meaningful player progression events
- โข Use
track_client_event()
for UI-specific actions
โ Avoid This
- โข Tracking every frame or physics update
- โข Generic event names like
"event"
or"action"
- โข Empty payload dictionaries for important events
- โข Tracking before AutoLoad initialization
- โข Forcing client events for game-critical actions
- โข Including sensitive data in payloads
- โข Tracking duplicate events from multiple clients
- โข Using invalid dictionary structures
๐ Advanced Features
๐ Session Tracking
# Track complete game sessions extends Node var session_start_time: float var areas_visited: Array = [] var actions_performed: int = 0 func _ready(): session_start_time = Time.get_time_dict_from_system() Tokebi.track("session_started", { "platform": OS.get_name(), "screen_size": get_viewport().get_visible_rect().size, "language": OS.get_locale() }) func _exit_tree(): var session_duration = Time.get_time_dict_from_system() - session_start_time Tokebi.track("session_ended", { "duration_seconds": session_duration, "areas_visited": areas_visited, "actions_performed": actions_performed, "reason": "game_exit" })
๐ฏ Custom Player Events
# Create reusable tracking functions extends Node func track_player_progression(level: int, xp: int): Tokebi.track("player_level_up", { "new_level": level, "total_xp": xp, "time_played": get_total_playtime(), "achievements_unlocked": get_achievement_count() }) func track_combat_event(enemy: String, outcome: String): Tokebi.track("combat_" + outcome, { "enemy_type": enemy, "player_level": get_player_level(), "weapon_used": get_current_weapon(), "damage_dealt": get_damage_dealt(), "health_remaining": get_player_health() })
โ ๏ธ Error Handling
๐ก๏ธ Built-in Error Protection
The Tokebi SDK includes comprehensive error handling so tracking failures never break your game.
# The SDK automatically handles errors: func track(event_type: String, payload: Dictionary = {}, force_track: bool = false): # All tracking calls are wrapped in try/catch # Invalid payloads are logged but don't crash # Network failures are handled gracefully # Malformed data is sanitized automatically # You can also add your own error tracking: func track_error(error_msg: String, context: Dictionary = {}): var error_data = { "error_message": error_msg, "stack_trace": get_stack(), "scene": get_tree().current_scene.scene_file_path, "platform": OS.get_name(), "engine_version": Engine.get_version_info() } error_data.merge(context) Tokebi.track("error_occurred", error_data)
๐งช Testing and Debugging
โ Console Output
# The SDK provides detailed logging: [Tokebi] Initializing SDK... [Tokebi] Player ID: player_1642123456_7834 [Tokebi] Mode: Single Player [Tokebi] Game registered! ID: game_abc123 [Tokebi] Tracking: level_completed [Tokebi] Event sent successfully # Check the Output panel in Godot # for real-time tracking feedback
๐ Test Events
# Create a simple test script: extends Node func _ready(): # Wait for SDK to initialize await get_tree().create_timer(1.0).timeout # Test basic tracking test_tracking() func test_tracking(): print("Testing Tokebi tracking...") Tokebi.track("test_event", { "test_data": "hello world", "timestamp": Time.get_time_dict_from_system() }) print("Test event sent!")
๐๏ธ Payload Structure Guidelines
โ Good Payload Examples
# Simple values { "level": 5, "score": 1250, "completed": true } # Nested dictionaries { "player_stats": { "health": 100, "mana": 50 }, "location": "forest_area" } # Arrays { "items_collected": ["sword", "potion", "key"], "enemy_types": ["goblin", "orc"] } # Mixed types { "success": true, "attempts": 3, "time_taken": 45.7, "bonus_earned": "speed_bonus" }
โ Avoid These Patterns
# Don't include Godot objects { "player_node": player_reference, # โ Objects can't be serialized "scene": get_tree().current_scene # โ Complex objects } # Don't use functions or callables { "callback": my_function, # โ Functions aren't serializable "signal": some_signal # โ Signals aren't data } # Avoid overly complex nesting { "data": { "level1": { "level2": { "level3": { "too_deep": "hard to analyze" } } } } }
๐จ Common Use Cases
๐ฎ Game Genres
Platformer Games
Track jumps, deaths, level completion, collectibles
RPG Games
Level ups, quest completion, item usage, combat
Puzzle Games
Solutions found, hints used, time per puzzle
Action Games
Enemy defeats, weapon usage, power-ups
๐ Analytics Goals
Player Retention
Session length, return visits, feature usage
Game Balance
Difficulty spikes, progression rates, drop-offs
User Experience
UI interactions, navigation patterns, preferences
Performance
Load times, frame rates, error tracking
๐ง Troubleshooting
โ Plugin Not Appearing
- โข Make sure you ran the installer script with Ctrl+Shift+X
- โข Check that
addons/tokebi/
folder was created - โข Reload the project (Project โ Reload Current Project)
- โข Verify the installer didn't show any error messages
โ ๏ธ Events Not Tracking
- โข Ensure
tokebi.gd
is added to AutoLoad as "Tokebi" - โข Check the API key was entered correctly in the setup dock
- โข Verify you're calling
Tokebi.track()
after the SDK initializes - โข Look for error messages in the Output panel
- โข Try the test script from the debugging section
๐ Multiplayer Issues
- โข Client events are blocked by default (use
track_client_event()
) - โข Only the host/server should track most game events
- โข Use
force_track = true
for client-specific actions - โข Check multiplayer mode detection in console output
๐ฏ You're Ready!
Your Godot project is now equipped with powerful analytics. Start tracking events that matter to your game!
Check your Tokebi dashboard to see events in real-time and explore the Dashboard and Funnel Analytics features.