benecaster_analytics_downloads
Filters the tracked downloads for GET benecaster-analytics/v1/analytics/downloads: what every panel, export and digest built on them sees. $data has show_ids, date_from, date_to, tier_slug (always null: the tier filter does not apply to downloads), proxy_required (true when no show read tracks downloads, and then every figure is empty), shows ([{show_id, tracking}]), total, tiers ([{tier_slug, count}], largest first; untiered downloads under public), apps ([{app, count}], largest first then by name, summed by label across the shows) and episodes ([{episode_id, show_id, title, count, tiers}], largest first, at most episode_limit).
Every figure is read through benecaster_get_download_total() and benecaster_get_downloads_by(), so it includes days older than the 30-day raw log. The apps labels are those of benecaster_get_downloads_by( 'app', … ), in English: named by benecaster_download_app_patterns, Other for a User-Agent no pattern matches and Unknown for none. A show tracks downloads when its show-level default is on or any published episode is forced on; a show that does not is left out. Feed downloads only; refused downloads write no row. An episode’s tiers are its whole history in the range, including before it moved from another show.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data |
array |
— | The downloads 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 (always null), episode_limit |
Returns:
array
Example
// Leave a staff-only tier out of every panel, export and digest.
add_filter( 'benecaster_analytics_downloads', function ( array $data, array $args ): array {
$data['tiers'] = array_values( array_filter( $data['tiers'], fn( $t ) => 'staff' !== $t['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. Walkthrough: Read the Analytics Dashboard downloads by tier, by podcast app and by episode.
Need this built rather than just documented? See our services →