How to Track Cost per MAU with a Pull API Endpoint
Instead of pushing numbers every day, publish one endpoint and let ZopNight fetch it on a daily schedule. Here is what that endpoint has to satisfy.
Cost per monthly active user is the unit most product teams already quote, which makes it a good first unit metric. The MAU figure lives in your analytics or product database. With the Pull API source, you publish that figure on an HTTPS endpoint and ZopNight’s aggregator fetches it once a day, at 21:10 UTC. For the push and CSV alternative, see cost per order with pushed counts.
1. Pin down the MAU definition
MAU is a rolling or calendar-month count of distinct users with a qualifying action. Decide which one you publish, what counts as active (a login, a key action), and whether bots, internal staff and free-tier users are in. Then decide how often to publish it, which matters more than it looks (see step 6). The safe choice is one value per calendar month, dated on a fixed day such as the 1st.
2. Build the endpoint
It needs to:
- Be reachable over public HTTPS. Fetches pass an SSRF guard that resolves DNS and refuses private, loopback, link-local, carrier-grade NAT and equivalent IPv6 ranges, and re-validates every redirect. An internal-only hostname will be refused, not merely time out.
- Answer within 30 seconds with a body under 5 MB. Serve a precomputed value from a table rather than running the distinct-user count on each request.
- Sit behind authentication. The credential you register for the pull is stored encrypted, the same way cloud account credentials are.
Values are upserted by date, so fetching the same day twice overwrites it rather than creating a duplicate.
3. Register the pull source
In ZopNight, create a unit metric, from the catalog’s MAU template or your own, and choose Pull API as the source. Enter the endpoint URL, the authentication details and the interval. Choose a display scale of 1, 100 or 1,000; scale only changes how values are displayed.
4. Test before you wait a day
Press Test fetch. It runs the full pull path synchronously, address guard included, so a certificate problem, a slow query or a blocked address shows up now rather than as a missing point tomorrow.
5. Backfill history
For months before the source existed, upload a CSV of date and value rows to the same metric (up to 1 MB and 5,000 rows) or push them once through the API. All three inputs write to the same series.
6. Read cost per MAU
On Cost Reports, the trend chart gains a cost-per-MAU axis. Each bucket is total cost divided by the sum of metric values in that bucket, and buckets whose denominator is zero are skipped. That is right for orders or requests and wrong for MAU published daily: a month of daily trailing-30-day MAU values sums to roughly thirty times your real MAU. Publish one MAU value per month and read the chart at monthly granularity, and the division is exactly cost per MAU. Scope it to a team or a tag to see, for example, what the platform team’s spend is per active user. If no team-level MAU exists, the org-wide MAU is used as the denominator.
If a point is missing
Check, in order: the endpoint returned the day (call it yourself with the same credential), the fetch happened after 21:10 UTC, and Test fetch still passes. A registered source that fails is easier to fix from the Test fetch error than from a gap in a chart. Background on picking a denominator is in cost per MAU.