Overview

Stats3x3 min readPage 1 of 7
On this page 3

About

Stats3x is website visit statistics for MODX 3 without external services: visitors, visits, page views, sources, devices, geography, visitor actions and goals. Optionally - session recordings you can watch like a video, a click map and email reports via the Vestnik component. All data is stored on your server, no third-party scripts are added to the pages.

How it works

  1. The Stats3x snippet adds the st3x.js file to the page (about 3 KB gzipped). The script sends page view data with navigator.sendBeacon and does not slow down page loading.
  2. The action.php file accepts the request without loading MODX and without touching the database: it appends one line to the current minute file in the data folder and responds with code 204.
  3. Once a minute cron.php parses the files of the past minutes: it drops bots and excluded IPs, detects the visitor, visit, device, country and source, counts goals and writes the data to the database.
  4. Once an hour cron recalculates the daily totals, once a day it deletes detailed data older than stats3x.keep_details_days days. Daily totals are kept forever.
  5. If session recording is enabled, the recording script rec.js is loaded only for sampled visits and sends the recording to action.php in parts. Every 5 minutes cron assembles the parts into finished recordings.
  6. Reports in the manager read only processed data: today - from the detailed tables, past days - from the daily totals.

Where the numbers come from

  • The period is chosen with the buttons above the reports: today, yesterday, 7 days, 30 days, this or last month, custom dates. The funnel button next to a table row adds a filter: all tabs, the visit list and recordings show only matching visits. The filter is shown above the reports and is removed there.
  • Past days come from the daily totals (cron recalculates them once an hour), today comes from the detailed data with a delay of up to a minute.
  • Filters are calculated from the detailed data, so they work for the last stats3x.keep_details_days days.
  • Visitors in breakdowns over several days are the sum of visitors per day: someone who came on two different days is counted twice. The main numbers in the Summary show the exact number of visitors.
  • A bounce is a visit with a single page view shorter than 15 seconds. Changes in the Summary are compared to the previous period of the same length.
  • Sites with subdomains: each visit remembers the domain of its entry page (without www.). If there were visits on several domains, the Summary shows a Domains table, and the visit and recording lists show a Domain column; the funnel button next to a domain keeps only that domain in all reports, visits and recordings.