Understanding User Behavior Analytics by Playing 2048

Having user data captured and ready for analytics in any tool or a data warehouse is a pretty compelling concept. But what’s actually happening when we track clickstream data?

Well, there are different types of clickstream events that can be tracked through various API calls. We’ve thrown together a basic example to give you some hands-on experience with our track API call by playing a little game we all know and love: 2048.

For those who aren’t familiar with this game, the objective is to combine like numbers until you’ve made a 2048 tile. When you play 2048, you are telling the app to either move tiles up, down, left or right. Each of these movements represents a specific event that is logged by this track call:

  "method": "track",
  "request": {
    "integrations": {},
    "context": {
      "page": {
        "path": "/2048/",
        "referrer": "",
        "search": "",
        "title": "Astronomer's 2048",
        "url": "https://astronomerio.github.io/2048/"
    "properties": {
      "anonymousId": "c027b3e0-07a0-4d64-b537-a157a9f6fa15"
    "event": "up",
    "anonymousId": "c027b3e0-07a0-4d64-b537-a157a9f6fa15",
    "timestamp": "2017-10-26T14:50:53.815Z"

Once those events are tracked, they can be pushed to a warehouse or analytics tool of your choice. We’ve chosen to use Keen.io, an event data platform made for real-time data application. By tracking our 2048 events to Keen.io through Astronomer, we avoid the hassle of implementing various Keen API libraries in our site’s framework. With Astronomer, we just need to enable the proper destination in the UI.

You can learn more about our Keen.io destination here.

Let’s walk through gameplay to see exactly how events are tracked and logged. We have connected this client-side event tracking to Keen.io, which then records events in the panels on the right hand side of the page.

Let’s start start by pressing the up arrow on our keyboard, moving the tiles to the top of the box.

As you can see, the up arrow logs a track API call with the event name up. Once we refresh the page, we will see the event registered in our Keen.io panels.

There you have it; we’re well on our way to generating insights based on user event data! We’re not done yet, though. We are also able to issue a track call when a user starts a new game.

After collecting a more substantial amount of event data, we can track a variety of trends, such as:

  • How far into the game users get before starting a new game
  • Which corner of the board is most popular for users to move to
  • The minimum amount of key strokes it took for someone to win the game

Trends like these open up a world of potential insights, and that’s with only one possible API call!

Now, that you’ve seen our walkthrough, play the game. And if you’re ready to start capturing these user events—and more—from your own website or app, sign up for Astronomer today (your first 50k events are free!).

Subscribe to RSS
Ready to build your data pipelines?

Astronomer is the data engineering platform built by developers for developers. Send data anywhere with automated Apache Airflow workflows, built in minutes...