benecaster_analytics_tier_movement
Filters tier movement for GET benecaster-analytics/v1/analytics/tier-movement: moves ([{from_tier, to_tier, direction, count}], upgrades first, each largest first), per-tier joined, churned, upgraded_in, upgraded_out, downgraded_in and downgraded_out, totals, and notes for licence-grace rows and undated syncs. With a tier_slug, a move counts when either end is that tier. A move core could not rank is listed as upgraded.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data |
array |
— | The movement the route answers |
$args |
array |
— | The query: show_ids (only shows where the add-on is active), date_from and date_to (inclusive UTC Y-m-d), tier_slug |
Returns:
array
Example
add_filter( 'benecaster_analytics_tier_movement', function ( array $data, array $args ): array {
// Keep only moves into or out of the paid tiers.
$data['moves'] = array_values( array_filter( $data['moves'], fn( $m ) => 'free' !== $m['from_tier'] || 'free' !== $m['to_tier'] ) );
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. Walkthrough: Read the Analytics Dashboard tier breakdown and tier movement.
Need this built rather than just documented? See our services →