<buttonid="sidebar-toggle"class="icon-button"type="button"title="Toggle Table of Contents"aria-label="Toggle Table of Contents"aria-controls="sidebar">
<ahref="https://github.com/matrix-org/synapse/edit/develop/docs/usage/administration/monthly_active_users.md"title="Suggest an edit"aria-label="Suggest an edit">
<iid="git-edit-button"class="fa fa-edit"></i>
</a>
</div>
</div>
<divid="search-wrapper"class="hidden">
<formid="searchbar-outer"class="searchbar-outer">
<inputtype="search"id="searchbar"name="searchbar"placeholder="Search this book ..."aria-controls="searchresults-outer"aria-describedby="searchresults-header">
<h1id="monthly-active-users"><aclass="header"href="#monthly-active-users">Monthly Active Users</a></h1>
<p>Synapse can be configured to record the number of monthly active users (also referred to as MAU) on a given homeserver.
For clarity's sake, MAU only tracks local users.</p>
<p>Please note that the metrics recorded by the <ahref="../../usage/administration/monitoring/reporting_homeserver_usage_statistics.html">Homeserver Usage Stats</a>
are calculated differently. The <code>monthly_active_users</code> from the usage stats does not take into account any
of the rules below, and counts any users who have made a request to the homeserver in the last 30 days.</p>
<p>See the <ahref="../../usage/configuration/config_documentation.html#limit_usage_by_mau">configuration manual</a> for details on how to configure MAU.</p>
<h2id="calculating-active-users"><aclass="header"href="#calculating-active-users">Calculating active users</a></h2>
<p>Individual user activity is measured in active days. If a user performs an action, the exact time of that action is then recorded. When
calculating the MAU figure, any users with a recorded action in the last 30 days are considered part of the cohort. Days are measured
as a rolling window from the current system time to 30 days ago.</p>
<p>So for example, if Synapse were to calculate the active users on the 15th July at 13:25, it would include any activity from 15th June 13:25 onwards.</p>
<p>A user is <strong>never</strong> considered active if they are either:</p>
<ul>
<li>Part of the trial day cohort (described below)</li>
<li>Owned by an application service.
<ul>
<li>Note: This <strong>only</strong> covers users that are part of an application service <code>namespaces.users</code> registration. The namespace
must also be marked as <code>exclusive</code>.</li>
</ul>
</li>
</ul>
<p>Otherwise, any request to Synapse will mark the user as active. Please note that registration will not mark a user as active <em>unless</em>
they register with a 3pid that is included in the config field <code>mau_limits_reserved_threepids</code>.</p>
<p>The Prometheus metric for MAU is refreshed every 5 minutes.</p>
<p>Once an hour, Synapse checks to see if any users are inactive (with only activity timestamps later than 30 days). These users
are removed from the active users cohort. If they then become active, they are immediately restored to the cohort.</p>
<p>It is important to note that <strong>deactivated</strong> users are not immediately removed from the pool of active users, but as these users won't
perform actions they will eventually be removed from the cohort.</p>
<p>If the config option <code>mau_trial_days</code> is set, a user must have been active this many days <strong>after</strong> registration to be active. A user is in the
trial period if their registration timestamp (also known as the <code>creation_ts</code>) is less than <code>mau_trial_days</code> old.</p>
<p>As an example, if <code>mau_trial_days</code> is set to <code>3</code> and a user is active <strong>after</strong> 3 days (72 hours from registration time) then they will be counted as active.</p>
<p>The <code>mau_appservice_trial_days</code> config further extends this rule by applying different durations depending on the <code>appservice_id</code> of the user.
Users registered by an application service will be recorded with an <code>appservice_id</code> matching the <code>id</code> key in the registration file for that service.</p>
<h2id="limiting-usage-of-the-homeserver-when-the-maximum-mau-is-reached"><aclass="header"href="#limiting-usage-of-the-homeserver-when-the-maximum-mau-is-reached">Limiting usage of the homeserver when the maximum MAU is reached</a></h2>
<p>If both config options <code>limit_usage_by_mau</code> and <code>max_mau_value</code> is set, and the current MAU value exceeds the maximum value, the
homeserver will begin to block some actions.</p>
<p>Individual users matching <strong>any</strong> of the below criteria never have their actions blocked:</p>
<ul>
<li>Considered part of the cohort of MAU users.</li>
<li>Considered part of the trial period.</li>
<li>Registered as a <code>support</code> user.</li>
<li>Application service users if <code>track_appservice_user_ips</code> is NOT set.</li>
</ul>
<p>Please not that server admins are <strong>not</strong> exempt from blocking.</p>
<p>The following actions are blocked when the MAU limit is exceeded:</p>
<ul>
<li>Logging in</li>
<li>Sending events</li>
<li>Creating rooms</li>
<li>Syncing</li>
</ul>
<p>Registration is also blocked for all new signups <em>unless</em> the user is registering with a threepid included in the <code>mau_limits_reserved_threepids</code>
config value.</p>
<p>When a request is blocked, the response will have the <code>errcode</code><code>M_RESOURCE_LIMIT_EXCEEDED</code>.</p>
<p><code>synapse_admin_mau_current_mau_by_service</code> records the current MAU including application service users. The label <code>app_service</code> can be used
to filter by a specific service ID. This <em>also</em> includes non-application-service users under <code>app_service=native</code> .</p>
<p><code>synapse_admin_mau_registered_reserved_users</code> records the number of users specified in <code>mau_limits_reserved_threepids</code> which have