SOLVED

Re: Scripted token issue - not resolving to correct URL

Go to solution
Kevin_Stinson
Level 3

Scripted token issue - not resolving to correct URL

We are having an issue with a token.

 

We are dynamically creating a URL for a link to a PDF. When we have the full URL set in a variable $murl the link points to the correct PDF. It all works fine but there is no tracking link.

#set($murl = "https://www.franklintempleton.com/investments/options/mutual-funds/products/$fund.fundOneTISNumber/$...")

<a target="_blank" href="${murl}" style="font-family: arial; text-decoration: underline; font-weight: bold;">

 

But if we remove the https:// from the variable and add it in the in the link portion of the script so we can get tracking the link, the link generated with tracking does not go to the correct URL. They all seem to point to the same PDF.

#set($murlPartial = "www.franklintempleton.com/investments/options/mutual-funds/products/$fund.fundOneTISNumber/$fund.sha...")

<a target="_blank" href="https://${murlPartial}" style="font-family: arial; text-decoration: underline; font-weight: bold;">

I have created a test where I render both versions on the email, and it looks like the variables are created fine when output on their own.

Kevin_Stinson_0-1648149818737.png

The main reason we are trying to separate the URL is to allow us to track the link.

Let me know if there is a better approach to take.

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Scripted token issue - not resolving to correct URL

This is a known limitation when you attempt to reuse the same Velocity $variable to output links. I wrote about the workaround here: https://blog.teknkl.com/multiple-marketo-tracked-links-in-velocity/

View solution in original post

7 REPLIES 7
Jo_Pitts1
Level 10 - Community Advisor

Re: Scripted token issue - not resolving to correct URL

@Kevin_Stinson ,

are you looping within Velocity and creating multiple URLs within a single email?


Can you show us the code?

 

Cheers

Jo

SanfordWhiteman
Level 10 - Community Moderator

Re: Scripted token issue - not resolving to correct URL

This is a known limitation when you attempt to reuse the same Velocity $variable to output links. I wrote about the workaround here: https://blog.teknkl.com/multiple-marketo-tracked-links-in-velocity/

Kevin_Stinson
Level 3

Re: Scripted token issue - not resolving to correct URL

@SanfordWhiteman yes, we are looping through with the script. I will take a look at your work-around. Thanks!

Kevin_Stinson
Level 3

Re: Scripted token issue - not resolving to correct URL

Sorry for the delay, other priorities came up.

But relooked at the existing token and I may need one of our developers to look at implementing your code. There is a lot going on in the token now.

#foreach($fund in $sorter.sort($monthlyFundUpdates_cList,["rankIndex:asc","fundNameMarketing:asc","fund_Nasdaq_Symbol:asc"]) )
#if($velocityCount<=10)
<table border="0" bgcolor="#ffffff" width="100%" cellpadding="0" cellspacing="0" style="border-bottom: 1px solid #eeeeee;">
<tbody>
<tr>
#set($mFundNum = $fund.fundInvestarNumber)
#set ($index = $mFundNum.indexOf('00'))
#set ($index = $index + 2)
#set ($mFundID = $mFundNum.substring($index))


#set($murlPartial = "www.xyz.com/$fund.fundOneTISNumber/$fund.shareClassCode/")

<td width="20%" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px;" align="left"><span style="font-family: Arial, sans-serif; font-size: 13px; color: #000000;"><a target="_blank" href="https://${murlPartial}" style="font-family: arial; text-decoration: underline; font-weight: bold;">    
    #if($fund.fund_Nasdaq_Symbol)
        $fund.fundNameMarketing - ($fund.fund_Nasdaq_Symbol)
    #else
        $fund.fundNameMarketing
    #end
</a>
</span></td>
<td width="8%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center">    
    #if($fund.shareClass)
        $fund.shareClass
    #else
        -
    #end    
</td>
<td width="11%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center">    
    
    ##if(parse.float($fund.distributionRate)>0.00)
   #if($fund.distributionRate)
     #if(($mFundID == '00150' || $mFundID == '00250' || $mFundID == '00353' || $mFundID == '00650' || $mFundID == '00850'|| $mFundID == '00192'|| $mFundID == '00292'|| $mFundID == '00372' || $mFundID == '00192' || $mFundID == '00292' || $mFundID == '00372' || $mFundID == '00384' || $mFundID == '00385' || $mFundID == '00386' || $mFundID == '00484' || $mFundID == '00485' || $mFundID == '00486' || $mFundID == '00584' || $mFundID == '00585' || $mFundID == '00586' || $mFundID == '00641' || $mFundID == '00642' || $mFundID == '00643' || $mFundID == '00692' || $mFundID == '00884' || $mFundID == '00885' || $mFundID == '00886') && $fund.isLeggMasonProduct == 'N')
		-
	 #else
		#set($value_rate = $fund.distributionRate)
        #set($ScoreCount = $convert.toNumber($value_rate) )
  
		#if( $ScoreCount != 0 )    
			$number.format('#0.00', $fund.distributionRate)%
		#else
			-
		#end   
      #end
    #else
        -
    #end      

</td>
<td width="11%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center">    
     
    
    #if($fund.standardized_Yield)
     #if(($mFundID == '00150' || $mFundID == '00250' || $mFundID == '00353' || $mFundID == '00650' || $mFundID == '00850'|| $mFundID == '00192'|| $mFundID == '00292'|| $mFundID == '00372' || $mFundID == '00192' || $mFundID == '00292' || $mFundID == '00372' || $mFundID == '00384' || $mFundID == '00385' || $mFundID == '00386' || $mFundID == '00484' || $mFundID == '00485' || $mFundID == '00486' || $mFundID == '00584' || $mFundID == '00585' || $mFundID == '00586' || $mFundID == '00641' || $mFundID == '00642' || $mFundID == '00643' || $mFundID == '00692' || $mFundID == '00884' || $mFundID == '00885' || $mFundID == '00886') && $fund.isLeggMasonProduct == 'N')
		-
	 #else
		#set($value_rate1 = $fund.standardized_Yield)
		#set($ScoreCount1 = $convert.toNumber($value_rate1) )
  
		#if( $ScoreCount1 != 0 )    
			$number.format('#0.00', $fund.standardized_Yield)%
		#else
			-
		#end   
      #end
    #else
        -
    #end    
</td>
<td width="11%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center">
    
    #if($fund.yTDTotalReturn)
        $number.format('#0.00', $fund.yTDTotalReturn)%
    #else
        N/A
    #end
</td>
<td width="39%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 11px; font-weight: bold; border-left: 1px solid #eeeeee; padding: 0px 0px 0px 0px;" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center">
    #if($fund.av_An_Tot_Ret_1)
        $number.format('#0.00', $fund.av_An_Tot_Ret_1)%        
    #else
        N/A
    #end
</td>
<td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center">    
    #if($fund.av_An_Tot_Ret_3)
    $number.format('#0.00', $fund.av_An_Tot_Ret_3)%
    #else
        N/A
    #end
</td>
<td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center">
    
    #if($fund.av_An_Tot_Ret_5)
    $number.format('#0.00', $fund.av_An_Tot_Ret_5)%
    #else
        N/A
    #end

</td>
<td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center">
    
    #if($fund.av_An_Tot_Ret_10)
    $number.format('#0.00', $fund.av_An_Tot_Ret_10)%
    #else
        N/A
    #end
</td>
<td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" class="nav6" align="center"> 
    
    #if($fund.av_An_Tot_Ret_Life)
    $number.format('#0.00', $fund.av_An_Tot_Ret_Life)%
    #else
        N/A
    #end
    <br /><span style="font-size: 9px; font-weight: bold; color: #777;">
     
    #if($fund.pER_Fund_Inception_Date)
        $date.format("MM/dd/yyyy", $convert.parseDate($fund.fundPerformanceInceptionDate, "yyyy-MM-dd")) 
    #else
        N/A
    #end
          </span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
#end
#end
Jo_Pitts1
Level 10 - Community Advisor

Re: Scripted token issue - not resolving to correct URL

@Kevin_Stinson ,

Focussing on the link tracking issue for now, is there a theoretical maximum number of fund updates one person can receive?

 

BTW - I have several thoughts on how to make the token a little more manageable (and I imagine @SanfordWhiteman has even more)

 

Cheers

Jo

 

Kevin_Stinson
Level 3

Re: Scripted token issue - not resolving to correct URL

@SanfordWhiteman we implemented your solution and the variable issue we had is now working and we see the tracking by pulling out the https:// from the main variable.

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Scripted token issue - not resolving to correct URL

Cool!