Analytics for your PICO-8 game, powered by Segment.
See a video demo of a fully-instrumented Jelpi demo: View Link
Note: I created this project for Segment Hack Week. Consider it alpha quality, since it doesn't support the functionality of Segment's official sources.
PICO-8 is a tool that you can use to create (and distribute) small, retro-style games. It's like Unity – the game engine – but with more design constraints to encourage you to keep your project scope small. Admittedly, it's kinda nerdy.
Segment is an awesome analytics product that intends to be your customer data infrastructure. You can use Segment to track user events, send events out to hundreds of analytics tools automatically, and use these tools to derive insights from your data. Armed with these insights, you can find ways to improve your game's design.
If you're new to PICO-8, I suggest skimming the manual for an overview.
Copy and paste track.lua
into your PICO-8 game.
track.lua
will expose a single function track()
globally. To use:
-- API:
track(event, properties?)
-- Example:
track('Level Cleared', {
level = 4,
time = 39.2,
found_secret_room = true,
})
You can track as many events and properties as you want, subject to PICO-8's char and token limits. track.lua
serializes track()
calls to PICO-8's GPIO pins, so be aware that you have 128 bytes of info per track()
call.
In the PICO-8 console, export your game to HTML5:
> EXPORT YOUR_GAME.HTML
Find your <script>
tag in the generated HTML. It should look like this:
<script async type="text/javascript" src="your_game.js"></script>
Above it, insert the contents of track.html
, then the analytics.js
snippet (view here). Verify that your Segment write key is present – check the setup instructions for details.
You can reference track_test.html
as an example.
If all goes well, you should see events flowing through to Segment's Debugger:
You now have the ability to understand how players interact with your game's design! Go forth and inform your designs with data.
Please open an issue.
analytics-pico8
is released under the MIT License.
Copyright © 2018 Segment.io, Inc.