benecaster_analytics_digest_data
Filters the raw data payload before digest sections are rendered. Use to inject additional data — e.g. donation totals from Listener Support — that benecaster_analytics_digest_sections can reference in a custom section. After this filter, the type-specific variant fires (benecaster_analytics_digest_data_daily/weekly/monthly) with 3 params ($type omitted).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data |
array |
— | Assembled query results for the period (subscriber counts, tier breakdown, episode downloads, engagement rates, etc.) |
$type |
string |
— | 'daily', 'weekly', or 'monthly' |
$show_id |
int |
— | ID of the show |
$period |
array |
— | Period bounds: {start: string, end: string} (ISO 8601 dates) |
Returns:
array
Example
add_filter( 'benecaster_analytics_digest_data', function( $data, $type, $show_id, $period ) {
// Inject Listener Support donation totals into the digest payload.
if ( 'weekly' === $type ) {
$total = my_plugin_get_donation_total( $show_id, $period['start'], $period['end'] );
$data['donation_total'] = $total;
}
return $data;
}, 10, 4 );