Add link using PHP but with Mailpoet Analytics
-
Hello, I have created a shortcode using PHP which links my custom post type in mailpoet emails and I just add [shortcode] in mailpoet editor, all the formatting and links comes from shortcode, now it works fine but problem is when someone click on the link of those custom post from email, mailpoet analytics doesn’t register that, so even if someone clicked on them it shows 0 clicks in analytics summary.
now I have others links as well which I have added through mailpoet editor it shows links like this
https://site.com/?mailpoet_router&endpoint=track&action=click&data=WyIyODg5IiwiZWUwODJhZGU0ZjAyZTM2NzA4MzFmO
but the link I have added in through shortcode just shows as https://site.com/custom-post etc.
can you guide me or give a hint to solve this so it also track clicks on shortcode’s links also.
here is how my shortcode is linking to postsadd_filter(‘mailpoet_newsletter_shortcode’, ‘mailpoet_custom_shortcode’, 10, 6);
function mailpoet_custom_shortcode($shortcode, $newsletter, $subscriber, $queue, $newsletter_body, $arguments) {
…………
…..
$output .= '<td width="50%" style="padding: 0 10px; text-align: center; vertical-align: top;">';
if ($post_thumbnail) {
$output .= '<a href="' . esc_url($post_url) . '" target="_blank"><img src="' . esc_url($post_thumbnail) . '" alt="' . esc_attr($post_title) . '" style="max-width: 100%;"></a>';
}
$output .= '<a href="' . esc_url($post_url) . '" target="_blank" style="color:red;text-decoration: none;"><h2 style="text-align: left;; font-size:16px;">' . $post_title . '</h2></a>';
The topic ‘Add link using PHP but with Mailpoet Analytics’ is closed to new replies.