Git Product home page Git Product logo

analytics-pico8's Introduction

analytics-pico8

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.


Wait, what?

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.


Awesome, how do I use it?

Learn

If you're new to PICO-8, I suggest skimming the manual for an overview.


Copy and paste

Copy and paste track.lua into your PICO-8 game.


API

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.


Export, insert track.html and analytics.js

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.


Celebrate

If all goes well, you should see events flowing through to Segment's Debugger:

screen shot 2018-08-08 at 1 50 50 pm

You now have the ability to understand how players interact with your game's design! Go forth and inform your designs with data.


Feedback

Please open an issue.


License

analytics-pico8 is released under the MIT License.

Copyright © 2018 Segment.io, Inc.

analytics-pico8's People

Contributors

nucleartide avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.