Re: Velocity Link Tracking Issue

Anonymous
Not applicable

Velocity Link Tracking Issue

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.

11 REPLIES 11
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Link Tracking Issue

$link is a reserved word in Velocity, though I don't think that's your problem here.

There's nothing else notably wrong with your approach. The problems with tracking VTL-emitted links come when you reuse the same variable name in a loop, which you aren't doing here, and I don't have a problem when I plug in your code.

How are you testing? Are you using a Send Sample (don't do this, use a real email!) and what are the exact results you're seeing in the received email?

Anonymous
Not applicable

Re: Velocity Link Tracking Issue

I'm testing with actual emails in a test campaign, but the links are not converted to the tracking format (they stay exactly as i input them, so www.marketo.com instead of go.marketo.com/34ay9wh0rtihskbnhrt90).

Could it be a problem that I'm using multiple similar scripts (3) in one e-mail?

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Link Tracking Issue

Yes, if the other scripts reuse the same variables for link output.

Note there's no problem in general with using multiple Velocity tokens -- in fact, it's highly recommended and I couldn't get by without separating my logic into multiple tokens. The problem is only with links + variables and the way Marketo post-processes VTL.

Anonymous
Not applicable

Re: Velocity Link Tracking Issue

That's the odd thing; I am not reusing the same variables for link output. I am sending a personalized code to Marketo from which I subtract 3 substrings ($article1, $article 2 and $article 3) for which I am using the following logic:

script token 1:

#if($article1 == "2")

<html code for article 1, version 2>

#elseif($article1 == "3")

<html code for article 1, version 3>

and then for script token 2:

#if($article2 == "1")

<html code for article 2, version 1>

#elseif($article2 == "3")

<html code for article 2, version 3>

However, even link in the simple script I posted above with emailtype did not convert to a trackable link so I don't think this is the problem? 😕

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Link Tracking Issue

Your code above actually does use the same variable twice, I didn't catch that before. Use $link1, $link2, $link3, etc., don't use the same variable name to build more than one <a> link -- even if it has the same value!

Anonymous
Not applicable

Re: Velocity Link Tracking Issue

I have also tried setting and using 2 different variables ($link1 and $link2) but that also didn't change anything as none of the links ever in my script get transformed to a trackable link (like in version 1 or even just a simple script without any logic). I have filed a support ticket with Marketo as I'm starting to believe solving this issue is not within my reach, so let's hope for the best!

Thanks for thinking along!

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Link Tracking Issue

Let me make sure I'm following you.

Are you saying you do get a trackable link from a completely static link (output from Velocity, of course) but you don't get a trackable link if it contains a VTL variable, even if there's only one token and one link in the entire email?

'cuz I definitely can't replicate this behavior in my instances.  Maybe there's something up with your Velocity install in particular. It happens.

Anonymous
Not applicable

Re: Velocity Link Tracking Issue

No, none of the links from Velocity get converted to a trackable link, whether they are completely static or partly dynamic (i.e. with a variable).

Is there a way to reinstall Velocity?

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Link Tracking Issue

Is there a way to reinstall Velocity?

No, this is very much out of our hands as it's core Marketo infrastructure.

If you don't see any tracked links there's definitely something wrong with your instance.