Skip to main content
Maria_Zonk
Level 2
Dec 7, 2022 4:59 AM UTC
Solved

Email Tracking not working on velocity token

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.
Darshil_Shah1
Darshil_Shah1Accepted solution
Adobe Champion, Community Advisor, UG Leader
Dec 7, 2022 6:31 AM UTC

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

 

5 replies

SanfordWhiteman
User Group Leader
User Group Leader
Dec 7, 2022 5:30 AM UTC

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”?

Translate
Maria_Zonk
Level 2
Dec 7, 2022 5:56 AM UTC

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. 

Translate
Darshil_Shah1
Adobe Champion, Community Advisor, UG Leader
Darshil_Shah1Adobe Champion, Community Advisor, UG LeaderAccepted solution
Adobe Champion, Community Advisor, UG Leader
Dec 7, 2022 6:31 AM UTC

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

 

Translate