benecaster_analytics_digest_sections
Filters the ordered section array after the data payload is finalized. Each section is {id: string, title: string, data: array, template: string}. Built-in section IDs: subscriber_snapshot, new_and_lost, episode_pulse, feed_engagement, benchmark_comparison, notable_callout. All callbacks should guard with benecaster_addon_is_active(‘analytics-dashboard’).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$sections |
array |
— | Ordered array of section objects {id: string, title: string, data: array, template: string} |
$type |
string |
— | 'daily', 'weekly', or 'monthly' |
$show_id |
int |
— | ID of the show |
$data |
array |
— | The already-filtered data payload |
Returns:
array
Example
add_filter( 'benecaster_analytics_digest_sections', function( $sections, $type, $show_id, $data ) {
// Append a custom "Donation Totals" section if the data was injected upstream.
if ( isset( $data['donation_total'] ) ) {
$sections[] = [
'id' => 'donation_totals',
'title' => 'Listener Support',
'data' => [ 'total' => $data['donation_total'] ],
'template' => 'my-addon/digest-donation.php',
];
}
return $sections;
}, 10, 4 );