Skip to content

Instantly share code, notes, and snippets.

@formatt-c
Last active September 30, 2018 19:28
Show Gist options
  • Save formatt-c/72bb9789adbafde858893817d3eee90a to your computer and use it in GitHub Desktop.
Save formatt-c/72bb9789adbafde858893817d3eee90a to your computer and use it in GitHub Desktop.
Add Google Analytics to your Bitsy game.

Google Analytics with Bitsy

It's very important to understand what's going on in your games and how players actually play your game. Here is a small writeup of how you can use Google Analytics event tracking with your Bitsy game. Since Bitsy is a very limited game engine this solution is hacky and maintainability is limited - but it works :D.

Setup

  1. Add a Google Analytics snippet to your exported game HTML file, refer to this link.

Note: The snippet should be placed near the top of the head section. Don't forget to enter your personal tracking ID of your analytics property.

  1. Add the following hack (by Sean S LeBlanc) to your exported game HTML file. Using this hack you can execute arbitrary JavaScript code from dialogs in Bitsy.

Usage

You can now fire Google Analytics events from dialogs in Bitsy with the following syntax:

API:
(js "ga('send', 'event', '<category>', '<action>', '<label>', <value>)")

// Event category and action are required, event label and value are optional. //

Examples:
(js "ga('send', 'event', 'found item', 'pick-axe')")
(js "ga('send', 'event', 'game', 'completed', 'found treasure')")

Possible usage:

  • Progress (How far do players play the game?): Put an invisible item over an exit to track screen by screen / level to level progress of players.
  • Player choices (What do players do?): Track different events based on branching dialogs.
  • Items (Can players find certain items?): Track if player has found a certain item in the game.
  • etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment