Analytics#
Once your game is published, Moud counts how people play it and shows you the numbers on the game's Analytics page on the website: visits, players, how long they stay, whether they come back, where they found the game, and how your servers hold up. You write no code for any of that.
What Moud cannot know is what happens inside your game. Did players finish level 3? Which sword do they buy? Where do new players give up? For those, server scripts send custom events, and they show up on the same page next to the rest.
Custom events#
analytics.event takes a player, a name, and optionally a few fields:
-- server
local function finished(player: Player, level: number, seconds: number)
analytics.event(player, "level_complete", { level = level })
if seconds < 60 then
analytics.event(player, "level_fast", { level = level })
end
end
local function bought(player: Player, item: string)
analytics.event(player, "item_bought", { item = item, currency = "coins" })
end- Each call counts one
level_completefor that player. On the website the event gets a row with how many times it happened and how many players sent it. - The fields split that row. Opening
level_completeshows one line per level,level=1,level=2and so on, each with its own counts, so you see how far players get without making an event per level. item_boughthas two fields. They are written out sorted by name,currency=coins, item=Sword, so the same pair always lands on the same line however you order them in the table.
An event name is up to 50 letters, digits, spaces and _ . : -. A field name is up to 30 letters,
digits and _, and a value is text, a number or true/false of up to 40 letters. An event has at
most 4 fields. Breaking any of these throws right away, in the script, so a typo shows up the first
time the line runs.
Keep values few. A field like level with ten possible values gives ten lines; a field holding a
player's score gives a line for every score anyone ever had, and the table stops telling you
anything. Round them, or put them in buckets like "0-99", "100-999".
analytics.event never waits. Events are kept on the server and sent to Moud a batch at a time,
every few seconds, so you can call it in the middle of game logic.
Funnels#
A funnel is a row of steps every player should go through in order, like a tutorial. Moud shows how many players reached each step, so the step where the count drops is where players leave.
-- server
game.players.joined:connect(function(player)
analytics.step(player, "tutorial", 1, "joined")
end)
moveTarget.touched:connect(function(other)
local player = game.players:playerOf(other)
if player then
analytics.step(player, "tutorial", 2, "walked to the flag")
end
end)
swordPickup.touched:connect(function(other)
local player = game.players:playerOf(other)
if player then
analytics.step(player, "tutorial", 3, "picked up the sword")
end
end)The funnel is named tutorial, and each step has a number from 1 to 50 and a name. On the website
the steps are listed in number order with the share of step 1 that reached each one: 100%, then
maybe 80%, then 35%, which tells you the sword is hard to find. A player counts once per step per
day, so walking back to the flag does not count twice.
Testing in the editor#
When you play in the editor, events go nowhere: there is no published game to count them for. The calls still check their arguments, so a wrong name or field throws in the editor like it would on a live server.
What Moud counts for you#
These come from the catalog and your fleet as players join and leave:
| Number | What it is |
|---|---|
| Visits | each time a player was sent to one of your servers |
| Unique players | players who played at least once in the time shown |
| New players | players who played for the first time |
| Playing at once | sampled every minute, the peak and the average |
| Session length | from the moment a player is on any of your servers until they are on none, so a teleport between your places stays one session |
| Day 1 and day 7 retention | of the players who first played on a day, the share who played again the next day, and seven days later |
| Where players come from | the Moud home, Discover and search, a friend, or a link to the game's page |
| Servers and crashes | servers running at once, and servers that stopped by themselves |
Retention is worked out per day in UTC, and only for days that are over: a player who first played today cannot have come back tomorrow yet, so today is left out.
Privacy#
The page only ever shows totals. Moud keeps, per game, which players have played and when they first came, because unique players and retention cannot be counted without it, but no page shows that list, and the per player rows behind custom events are dropped after a few days. Counters per hour are kept for about a month, the daily ones for good.
Limits#
A server can send about 120 events a minute, plus 30 for each player on it. A batch that goes over is dropped with a warning in the server log rather than an error in your script, since a lost event should never break a game.
