Skip to main content

benecaster_analytics_feed_engagement

Filter Premium analytics-dashboard

Filters the feed engagement counts for GET benecaster-analytics/v1/analytics/feed-engagement: how recently each tier’s active subscribers last polled their feed, as of now. There is no date range. Each active token is in exactly one bucket, on the same bands and edges as the Subscribers screen, at each show’s own engagement threshold T: active (within T, labeled Active), at_risk (T to 2T, labeled Low), lapsed (beyond 2T, labeled At risk), never (Never set up) and awaiting (never polled, still inside the grace period). active_7d counts the tokens that polled in the last 7 days.

Parameters

Name Type Default Description
$data array — The counts the route answers
$args array — The query: show_ids (only shows where the add-on is active), tier_slug

Returns: array

Example

add_filter( 'benecaster_analytics_feed_engagement', function ( array $data, array $args ): array {
    foreach ( $data['tiers'] as &$tier ) {
        $tier['active_7d_pct'] = $tier['total'] > 0 ? round( $tier['active_7d'] * 100 / $tier['total'], 1 ) : null;
    }
    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. The keys are not the screen's labels: at_risk is the band labeled Low, and lapsed the band labeled At risk. Walkthrough: Read the Analytics Dashboard feed engagement buckets.

Need this built rather than just documented? See our services →