10 Replies Latest reply on Apr 25, 2018 1:09 AM by Sanford Whiteman

    Velocity Link Tracking Issue

    Inge Schenk

      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.

        • Re: Velocity Link Tracking Issue
          Sanford Whiteman

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

            • Re: Velocity Link Tracking Issue
              Inge Schenk

              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?

                • Re: Velocity Link Tracking Issue
                  Sanford Whiteman

                  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.

                    • Re: Velocity Link Tracking Issue
                      Inge Schenk

                      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? :/