Skip to main content

benecaster_email_editor_engagement

Filter Premium email-editor

Filters what benecaster_email_editor_get_engagement() answers for a show: each episode notification and broadcast, newest first, with how many it reached, opened and clicked. It does not run when the function returns null.

Parameters

Name Type Default Description
$result array — Each send: `type`, `send_id`, `sent_at`, `recipients`, `opened`, `opens`, `clicked`, `clicks`, and `by_tier` when asked for
$show_id int — The show
$args array — What was asked for: `type`, `send_ids`, `since`, `until`, `by_tier`

Returns: array

Example

add_filter( 'benecaster_email_editor_engagement', function ( array $result, int $show_id, array $args ): array {
    // Leave out sends to fewer than ten people, whose rates mean little.
    return array_values( array_filter( $result, fn( array $send ): bool => $send['recipients'] >= 10 ) );
}, 10, 3 );

Notes

Return aggregates only: never add a user id, address or name. Walkthrough: Read a show's email opens and clicks.

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