Skip to content

Storage#

Each calendar month has its own table, named analytic_YYYYMM. The month is the month of the sample's start date. A week that starts on 26 October 2026 is stored in analytic_202610, even when it ends in November.

Month tables are created the first time a sample is written. Their names are not known at install, so hook_schema() does not declare them. hook_schema() does declare the analytic workspace. Live events stage() a row there, or add() to it, which sums value for the same (plugin, sequence, start, end). Neither call creates a month table.

promote() copies workspace rows into the month of start and deletes them. Pass the next day as $endBefore to move only rows whose end is earlier, and leave the open period staged. A promoted key is not in both tables. Scheduled collectors skip the workspace and call write().

A range read and the Views union include the workspace and every month the start dates touch.

Uninstall drops every analytic_YYYYMM table, the workspace, state keys that start with analytic.collector., and the analytic_collect queue.

The plugin column stores the collector config id. The unique key is (plugin, sequence, start, end). Writing or staging the same key again updates value, label, and timestamp.

sequence uses the same codes as Matomo:

Code Period
1 Day
2 Week
3 Month
4 Year

start and end are Y-m-d dates in the site timezone. value is a numeric column with precision 20 and scale 6. timestamp is the unix time the row was written.

There is no blob table, no site id, and no segment column.