(mochi) User Analytics Package

Announcing a user analytics package to supplement the companion site analytics.
At a glance:

  • Install from (mochi) User Analytics Package from the community tab
  • Segment users by how many total visits they have made
  • See average session times for each visit
  • Track individual events / milestones that players reach as well as average session time to reach
  • Ability to remove self data from analytics
  • Ability to white list who can pull up analytics
  • Ability to scroll using arrow keys if not all events fit on the screen

Image from Gyazo

Analytics Usage:
Drag the UserAnalyticsTemplate on to the user template to create the script folder. You now have user analytics being tracked!
To view, hold R / Y for three seconds by default.

  • debug - whether or not to print debug statements
  • maxBuckets - how many buckets of visits to track (3 buckets means users will be split into 1 time visitors, 2 time visitors, and 3+ time visitors)
  • ignorePastCap - If true, any visits past the max bucket will be ignored. If false, all visits past max bucket will be averaged into the last bucket


  • requireHold - whether or not to require holding down the button to bring up the window
  • holdTime - how many seconds required to bring up the window (only viewable when requireHold is true)
  • validUsers - array of usernames of users who can pull up the window
  • displayedEvents - which events should be displayed on the analytics window (events covered below)

Analytics Events Usage:
Analytics events can either be tracked by calling the function on the user entity script directly or through the helper script template.
Script Template: Drag the AnalyticsEventScriptsTemplate on to a desired trigger / entity.
AnalyticsEventScriptsTemplate exposes two functions that a trigger / entity can hook into in basic mode.
Once added, any basic event (that has the first argument as the player) should be able to call TrackPlayerEvent on the attached script and the event will then be tracked based on the properties set in the script.

Setting up event properties:

  • eventName = name of the event you want this interaction to be tracked as
  • allowDuplicates = whether or not to track instances of this event after the first time the user has performed the desired behavior.

If desired or needed, events can be tracked manually through lua when we have a reference to a user. Simply call userEntity:SendToScripts("TrackAnalyticsEvent", EVENT_NAME, ALLOW_DUPLICATES) where userEntity is the reference to the user entity, EVENT_NAME is the name of the event to track, and ALLOW_DUPLICATES is whether or not we want to allow duplicate events to be tracked - can be left off and will not allow duplicates by default.

If you have any questions, feedback, or bugs please let me know here or on discord @mochi. Thanks!