Change the UTM tags on a broadcast’s or an episode notification’s links
Web links in a broadcast or an episode notification get UTM tags once Benecaster has filled in each reader’s merge tags, in the HTML and the text part, before click logging puts each link behind its redirect. The filter runs once per kind of link in each email, so a tag can depend on the kind.
Code
<?php
add_filter( 'benecaster_email_utm_params', function ( array $params, string $email_type, ?int $episode_id, ?int $show_id, string $link ): array {
if ( 'unsubscribe' === $link ) {
return []; // Leave these links untagged.
}
$params['utm_term'] = 'my-term';
return $params;
}, 10, 5 );
Hooks Used
Need this built rather than just documented? See our services →