How do I add the Godot addon?

The Manalens Godot addon is open source (MIT) on GitHub. Download the v0.1.0 release, or clone the repository.

  1. Download the addon from the manalens-godot repository on GitHub.
  2. Move addons/manalens into the addons/ folder of your project.
  3. Open Project, Project Settings, Plugins, and enable Manalens. The plugin adds the Manalens autoload.

How do I start the Godot SDK?

Call init() once, in the _ready() of your first scene. The autoload is ready before your scene starts and stays loaded when you change scenes. Use the Publishable key from your project settings; it is safe to ship in a build. Leave the SDK on in the editor, so you can watch your events arrive. Editor and live data go to the same project, so the example sets build to dev in the editor; filter by build to leave editor runs out of a report.

GDScript

func _ready() -> void:
    Manalens.init({
        "publishable_key": "YOUR_PUBLISHABLE_KEY",
        "endpoint": "https://events.manalens.dev",
        "app_version": "1.4.0",
        "build": "dev" if OS.has_feature("editor") else "571",
        "storefront": "steam",
    })

How do I track game events in Godot?

Use flat snake_case names: level_start, level_complete, level_fail, resource, and purchase. Property values are String, int, float, bool, or null. Call identify() after the player signs in, and track_error() for errors that you catch yourself.

The functions of the Manalens Godot addon.
FunctionWhat it does
init(options)Starts the SDK and sends session_start and game_open
track(event, properties)Records an event
identify(user_id, traits)Attaches a player ID, kept on disk, and traits
track_error(message, options)Sends an error event with severity, error_type, and handled
link_url(url)Adds the handoff parameter to a website URL
set_consent(granted)Starts tracking, or deletes the ID, the session, and the queue
flush()Sends queued events now
await shutdown()Sends session_end and flushes before your own quit

GDScript

Manalens.track("level_complete", {"level": 3, "attempt": 1, "score": 1200})
Manalens.identify("player_42")
Manalens.track_error("Save failed", {"error_type": "SaveFailed", "severity": "critical"})

How do I check that Godot events arrive?

Press Play in the editor or run an exported build. Set debug to true to log each send and each dropped batch. Check that game_open and session_start appear in the project activity feed. Events are sent every 10 seconds, at 20 queued events, on focus loss, and on quit.

For a Web export, Manalens accepts requests from your project domain, its subdomains, and *.itch.zone. Add other game portals under Project settings, Allowed origins. To test the web export from the editor, add localhost.

Frequently asked questions

Which Godot versions are supported?

The addon needs Godot 4. It is plain GDScript with no native code and sends events with HTTPRequest, so it runs on Windows, macOS, Linux, Android, iOS, and Web exports. Automatic capture of engine and script errors needs Godot 4.5 or later.

What happens offline?

The queue is saved in user://manalens_queue.json, so events survive a crash or an offline session and are sent later with retries. At most 1000 events are kept, and events older than 7 days are dropped. Each event has a message ID, so a retry never counts twice.

How do I keep editor runs out of my reports?

Editor runs send events like a live game, so you can watch them arrive in the activity feed. Editor and live data go to the same project. Pass "build": "dev" if OS.has_feature("editor") else "571" to init(), and filter reports by build. To send nothing from the editor, pass "enabled": not OS.has_feature("editor") instead.

Is there a complete example?

Yes. The with-godot project in the Manalens examples repository on GitHub is a Godot 4 project with the addon, level events, track_error(), and link_url(). Run it headless with -- --demo to send a short set of events to a Manalens test project.

Sources and implementation