I have created a script that displays specific content for a user based on specific characteristics (I use email address in this simplified example). However, I am unable to track the links created in this script. Knowing that this is quite tricky in velocity, I followed all the instructions I could find but somehow it still doesn't work. Does anyone know how to fix this?
I listed both versions of my script below, as I thought maybe having the links in the if-logic (version 1) broke the tracking, but version 2 didn't work either.
Version 2:
#if($lead.Email == "myemail@mail.com")
#set ($link = 'www.marketo.com')
#set ($image = 'image.png')
#set ($header = 'Title')
#set ($text = 'Text text text.')
#set ($button = 'Click here')
#else
#set ($link = 'nope')
#set ($image = 'nope')
#set ($header = 'nope')
#set ($text = 'nope')
#set ($button = 'nope')
#end
<html>
<table>
<tbody>
<tr>
<td style="padding: 10px; text-align: center;"><a href="https://${link}" target="_blank"> <img src="https://ww2.mendix.com/rs/729-ZYH-434/images/${image}" width="379" border="0" class="fluid" style="height: auto;" /> </a></td>
</tr>
<tr>
<td style="padding: 16px 24px; text-align: left;" class="center-on-narrow">
<h2 style="margin-top: 0; font-size: 24px; line-height: 145%; font-weight: 300; color: #424242;">${header}</h2>
<p style="font-size: 16px; line-height: 170%; font-weight: 300; color: #424242;">
${text}
<br /></p>
</td>
</tr>
<tr>
<td style="padding: 0 24px 0 24px;">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tbody>
<tr>
<td align="center" bgcolor="#67ca39" style="-moz-border-radius: 500px; -webkit-border-radius: 500px; border-radius: 500px;"><a href="https://${link}" style="padding: 16px 52px; display: block; text-decoration: none; border: 1px solid #67ca39; text-align: center; font-weight: 300; font-size: 16px; font-family: sans-serif; color: #ffffff; background: #67ca39; -moz-border-radius: 500px; -webkit-border-radius: 500px; border-radius: 500px; line-height: 17px;" class="button pointerCursor"> ${button} </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</html>
Version 1
#if($lead.Email == "myemail@mail.com")
<html>
see code above, but with hardcoded $variables (i.e. html code for every if or else possibilities).
</html>
#else
<html>
see code above, but with hardcoded $variables (i.e. html code for every if or else possibilities).
</html>
Update: I have also tried using alternatives to #set, such as #define didn't work, also replacing $link with $url had no effect. No urls at all in velocity scripts seem to be converted to trackable links.