How to set tracking URL for custom link?

I don't know if it helps but if I do this, then it works:

PHP:
public static function transformLinksForTracking($content, Campaign $campaign, ListSubscriber $subscriber, $canSave = false)
{
//code here
$content = StringHelper::decodeSurroundingTags($content);$list = $campaign->list;$mustSave = false;

Of course, we don't want to edit MailWizz files, so I tried the following as well, but it didn't work:

PHP:
public static function transformLinksForTracking($content, Campaign $campaign, ListSubscriber $subscriber, $canSave = false)
{
$list = $campaign->list;
$content = Yii::app()->hooks->applyFilters('campaign_content_before_transform_links_for_tracking', $content, $campaign, $subscriber, $list);
$content = StringHelper::decodeSurroundingTags($content);$mustSave = false;
Actually, I take that back. The first code works but only creates a tracking URL for one subscriber -- the remaining have untracked URLs.
 
PHP:
if (!$onlyPlainText) {
 if (($emailFooter = $customer->getGroupOption('campaigns.email_footer')) && strlen(trim($emailFooter)) > 5) {$emailContent = CampaignHelper::injectEmailFooter($emailContent, $emailFooter, $campaign);
 }
 
 if (!empty($campaign->option) && !empty($campaign->option->embed_images) && $campaign->option->embed_images == CampaignOption::TEXT_YES) {
 list($emailContent, $embedImages) = CampaignHelper::embedContentImages($emailContent, $campaign);
 }
 
 if (!empty($campaign->option) && $campaign->option->xml_feed == CampaignOption::TEXT_YES) {$emailContent = CampaignXmlFeedParser::parseContent($emailContent, $campaign, $subscriber, true);
 }
 
 if (!empty($campaign->option) && $campaign->option->json_feed == CampaignOption::TEXT_YES) {$emailContent = CampaignJsonFeedParser::parseContent($emailContent, $campaign, $subscriber, true);
 }
 
//Code Here

 if (!empty($campaign->option) && $campaign->option->url_tracking == CampaignOption::TEXT_YES) {$emailContent = CampaignHelper::transformLinksForTracking($emailContent, $campaign, $subscriber, true);
 }
 $emailData = CampaignHelper::parseContent($emailContent, $campaign, $subscriber, true); 
 list($toName, $emailSubject, $emailContent) = $emailData;
 }

I also tried the above. It properly replaced the [xxx] shortcode with yyy but only the first subscriber's URLs have tracked URLs, the others have regular URLs for the custom shortcode.
 
@Lakjin - How about you show me the full extension code ?
Sorry for the late reply.
I actually figured it out. However, I have another question. Is it possible to include content in the HTML version of emails only and exclude it from the plain-text? I want the HTML and plain text emails to be the exact same except for one or two links that I want in HTML version only.
 
To clarify my last post, if I disable "Auto plain text" and manually modify the plain text version of emails, the plain text is not properly parsed.
 
Hello,
Perhaps there have been updates in recent years? How can I track clicks on custom links?
Tracking clicks on links that are added to the letter using custom tags does not work. Only [UNSUBSCRIBE_URL] and https://:confused:
Thanks in advance for any information
 
Tracking clicks on links that are added to the letter using custom tags does not work.
This might be because they are added after the tags have been parsed, so it's a chicken / egg problem.

Please describe us what you do exactly so we know if it's possible or not, but generally, if you have tried it and does not work, it means it is not possible.
 
This might be because they are added after the tags have been parsed, so it's a chicken / egg problem.

Please describe us what you do exactly so we know if it's possible or not, but generally, if you have tried it and does not work, it means it is not possible.
Thanks for the quick response.
We have a lot of tags with customer data sent through API into our lists. Some tags include text, some of them are raw links.

These links work in the letters well, but we have 0 clicks in the statistics.
When I try to compare simple links and links created by tags from the inbox, I see a clear difference: link created by tag works but don't have any redirection, here is no tracking element, just a direct link.

Could you help with it? How can I track custom links from tags?
If you need more information please ask freely
 
@laurentiu - Please prepare a test for this so we can take a look.
@Mayakovskii - Chances to fix this are very slim because of the nature of the problem, but let's take a look and we'll get back to you.
When you say:
We have a lot of tags with customer data sent through API into our lists. Some tags include text, some of them are raw links.
You mean like custom fields in the subscriber details, right? Like EMAIL / FNAME / etc, you also have these fields which contain these links, right?
 
@laurentiu - Please prepare a test for this so we can take a look.
@Mayakovskii - Chances to fix this are very slim because of the nature of the problem, but let's take a look and we'll get back to you.
When you say:

You mean like custom fields in the subscriber details, right? Like EMAIL / FNAME / etc, you also have these fields which contain these links, right?
Yes, absolutely right
We add these tags from custom fields
Looking forward to your test results
 
do you have any updates on this issue?
Yesterday we just released a huge version of the app, 2.0.31, so we've been busy with that and a few days we will be busy with fixing whatever issues come up with this release, then we will have the time to look into this. Priorities...
 
Yesterday we just released a huge version of the app, 2.0.31, so we've been busy with that and a few days we will be busy with fixing whatever issues come up with this release, then we will have the time to look into this. Priorities...
Understand, waiting for your reply when it will be possible. Thanks
 
Hello, any updates here?
Almost all of our links are from custom fields. Therefore, our statistics suffer greatly from this problem.

If possible, check and inform, please

Yesterday we just released a huge version of the app, 2.0.31, so we've been busy with that and a few days we will be busy with fixing whatever issues come up with this release, then we will have the time to look into this. Priorities...
Also, I would be glad of any information if someone else had this problem before
 
I just finished the round of tests and I can say that if you have urls inside custom fields, those urls are not parsed into tracking urls.
It is not a bug, they were never designed to work in this case.

I am checking now for a way to see if we can safely make this work. Stay tuned.
 
We found and implemented a feature that would allow urls in custom fields to be transformed in tracking urls.
It's now in the testing phase, if all okay, we'll include it in our next release.
 
Back
Top