Skip to main content

benecaster_analytics_growth_series

Filter Premium analytics-dashboard

Filters the subscriber growth series the Analytics Dashboard add-on builds for GET benecaster-analytics/v1/analytics/growth: what every panel, export and digest built on it sees. $data holds buckets, per-tier series in tiers (each {tier_slug, opening_active, points}), a total, and range notes. Each point carries active (the count at the bucket’s last day, null before any snapshot exists), the counters new, synced_dated, reactivated, churned, moved_in, moved_out, synced_undated, grace_churned, grace_reactivated, and net.

A point’s net always equals its active minus the previous point’s, so licence-grace churn and undated syncs are in net but never in churned or new.

A member Member Sync linked with their real start (synced_dated) counts in new on that start, and in active from that start up to the day the sync ran. That day is the synced event’s own recorded_at, which Reset Token never moves; a row written before Benecaster database 1.103.0 has no recorded_at and falls back to the member’s token issued_at. notes.synced_not_backfilled is non-zero when neither can place the sync day (a pre-1.103.0 row whose token has been reset since, or whose member was erased): those members are still in new but are not added to active before the sync.

Parameters

Name Type Default Description
$data array — The growth series the route answers
$args array — The query: show_ids, date_from, date_to (inclusive UTC Y-m-d), tier_slug, interval (day, week or month)

Returns: array

Example

add_filter( 'benecaster_analytics_growth_series', function ( array $data, array $args ): array {
    // Hide a staff-only tier from the chart.
    $data['tiers'] = array_values( array_filter( $data['tiers'], fn( $s ) => 'staff' !== $s['tier_slug'] ) );
    return $data;
}, 10, 2 );

Notes

Anything that is not an array is ignored and the unfiltered data is used. Guard with benecaster_addon_is_active( 'analytics-dashboard', $show_id ) for each show you act on. A callback that removes counts from a point should change net and active together, or the chart's lines and the tier table disagree. Walkthrough: Read or extend the Analytics Dashboard growth series.

Need this built rather than just documented? See our services →