benecaster_analytics_migration_funnel
Filters the migration funnel for GET benecaster-analytics/v1/analytics/migration-funnel, as of now: there is no date range and no tier. $data has show_ids, available (whether the Migration Wizard runs on the site), batches ([{show_id, show_name, id, source_platform, import_date, imported, completed, dropped, pending, grace_period_days, grace_ends_at, status, records_free_tiers}], newest import first across the shows, a batch with no import date last) and totals ({imported, completed, dropped, pending}, summed over batches).
Every figure is the Migration Wizard’s own, read per show through benecaster_migration_get_funnel(); pending is its still-to-finish count, never recomputed. A show the Migration Wizard is off for and a show that never migrated both contribute no batches, alike. import_date and grace_ends_at are ISO-8601 instants or null; source_platform and status are as stored.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data |
array |
— | The funnel the route answers |
$args |
array |
— | The query: show_ids (only shows where the add-on is active) |
Returns:
array
Example
// Leave out batches whose deadline was never enforced.
add_filter( 'benecaster_analytics_migration_funnel', function ( array $data, array $args ): array {
// Hide a test migration, and take it out of the totals too.
foreach ( $data['batches'] as $i => $batch ) {
if ( 42 === $batch['id'] ) {
foreach ( [ 'imported', 'completed', 'dropped', 'pending' ] as $key ) {
$data['totals'][ $key ] -= $batch[ $key ];
}
unset( $data['batches'][ $i ] );
}
}
$data['batches'] = array_values( $data['batches'] );
return $data;
}, 10, 2 );
Notes
Anything that is not an array is ignored and the unfiltered data is used. totals is not recomputed after the filter, so a callback that removes batches should adjust it too. Guard with benecaster_addon_is_active( 'analytics-dashboard', $show_id ) for each show you act on. Walkthrough: Read the Analytics Dashboard migration funnel.
Need this built rather than just documented? See our services →