I already found out how to edit your code example:
add_filter('mailpoet_newsletter_shortcode_link', 'mailpoet_custom_shortcode_referral_link', 10, 5);
function mailpoet_custom_shortcode_referral_link($shortcode, $newsletter, $subscriber, $queue, $arguments) {
// always return the shortcode if it doesn't match your own!
if ($shortcode !== '[link:referral]') return $shortcode;
$email = $subscriber->getEmail();
$name = $subscriber->getFirstName();
$referral_link = "https://example.com/thanks/?email={$email}&name={$name}";
return $referral_link;
}
Thanks anyway