Edit me

How does event collection work?

While MetaRouter can provide value for any company with a website or mobile app, we understand that clickstream data may be conceptually difficult to understand. To make it more digestible, we’ve thrown together a basic example in which you can get some hands-on experience with our track API call.


We crafted this example with a 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": "MetaRouter'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 MetaRouter, we avoid the hassle of implementing various Keen API libraries in our site’s framework. With MetaRouter, 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 show 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.

Now, that you’ve seen our walkthrough, click here to play the game yourself!