Email Tracking not working on velocity token | Community
Skip to main content
Maria_Zonk
New Participant
December 7, 2022
Solved

Email Tracking not working on velocity token

  • December 7, 2022
  • 1 reply
  • 2120 views

Hi, 

I have successfully created links using tokens that are trackable. 

However, this time I have a custom object with url link. 

I have tried multiple coding and either the link gets broken when mkto is adding the tracking token or the link works but the tracking token is not being added.  

Any tips/insights would be great! thanks!

 

Token1 - link gets broken when mkto token is being added. when tested $prodlinktrim on its own the syntax is as expected.  

 

#if(!$productRecommendation_cList.isEmpty()) #foreach($item in $productRecommendation_cList) #set($Prodlink=$item.rec_productLink) #set($Prodlinktrim=$Prodlink.replaceAll("^https://","")) #if($item.rec_rank=="1")<a href="https://$Prodlinktrim">link text</a> #else #end #end #end

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Darshil_Shah1

How about adding a set of curly braces around the variable where you're emitting its value in the anchor tag? 

 

I made a couple of changes and added comments in the script below FYR.

 

#if(!$productRecommendation_cList.isEmpty()) #foreach($item in $productRecommendation_cList) #if($item.rec_rank.equals("1")) ##In general, equals() function is better than "==" operator #set($Prodlink=$item.rec_productLink.replaceAll("^https://","")) <a href="https://${Prodlink}">link text</a> ##Try using {} around the $Prodlink #else ## You can remove else block if you don't intend to add anything in it. #end #end #end

 

1 reply

SanfordWhiteman
New Participant
December 7, 2022

You can’t output multiple tracked links using the same reference. Is it the case here that there’s no more than one matching item? What is the exact way that the link is “broken”?

Maria_Zonk
New Participant
December 7, 2022

Hi Sanford, 

There is only one link that meets the criteria rec_rank=="1".

We are currently using the code below which creates the right url but the clicks are not being tracked as the HTTPS is inside the token. 

#if(!$productRecommendation_cList.isEmpty()) #foreach($item in $productRecommendation_cList) #set($Prodlink=$item.rec_productLink) #if($item.rec_rank=="1")$Prodlink #else#end#end#end

 

When I change the code to the one in my initial post the url is ok when I hover over the link in the Marketo email preview. However, once I trigger a test email the link doesn't work. 

Darshil_Shah1
Darshil_Shah1Accepted solution
Community Manager
December 7, 2022

How about adding a set of curly braces around the variable where you're emitting its value in the anchor tag? 

 

I made a couple of changes and added comments in the script below FYR.

 

#if(!$productRecommendation_cList.isEmpty()) #foreach($item in $productRecommendation_cList) #if($item.rec_rank.equals("1")) ##In general, equals() function is better than "==" operator #set($Prodlink=$item.rec_productLink.replaceAll("^https://","")) <a href="https://${Prodlink}">link text</a> ##Try using {} around the $Prodlink #else ## You can remove else block if you don't intend to add anything in it. #end #end #end