How can I track links from Custom object fields though velocity | Community
Skip to main content
Level 2
January 28, 2026
Solved

How can I track links from Custom object fields though velocity

  • January 28, 2026
  • 1 reply
  • 36 views

Hi,

I have been able to create hyperlinks on fields bought in from a Custom object, however these are not being tracked.

All efforts to try and track links have resulted in just the variable being outputted and not the link itself.

Firstly is this possible or have I wasted a full morning?

If it can be done, what am I doing wrong. I’ve tried using AI to correct me but it just keeps circling back to the same mistakes.

Everything works exactly as I want it BAR the link which comes out as just ${trackedUrl}

Is there anything obv missing or shall I simply give up?

 

<table style="border-spacing: 0; border-collapse: collapse; width: 100%;">
  <tr>
    <th style="padding: 4px; font-family: arial; border-collapse: collapse !important"><strong>Policy Number</strong></th>
    <th style="padding: 4px; font-family: arial; border-collapse: collapse !important"><strong>Sponsor Name</strong></th>
  </tr>
  #foreach ($row in $multibillissue202511_cList) 
  #if ($row.dBID.contains("BEN")) 
  #set($dynamicURL = "https://${row.textField1}") 
  #set($trackedURL = $email.addTrackingToLink($dynamicURL, $row.textField1))
  <tr>
    <td style="padding: 4px; font-family: arial; border-collapse: collapse !important; width:100px"> ${row.policyNumber} </td>
    <td style="padding: 4px; border-collapse: collapse;"><a href="${trackedURL}" target="_blank">${row.sponsorName}</a></td>
  </tr>
  #end 
  #end
</table>

    Best answer by SanfordWhiteman

    Please use the Insert Code feature for readability going forward. (Click the three dots on the button bar.)

     

    Anyway:

    1. Yes, you can output tracked links from Velocity tokens. We do it all the time.
    2. Where are you getting the idea there’s an $email tool in Marketo’s Velocity implementation?
    3. Marketo always expects the protocol (http:// or https:// to be a constant, not part of the variable. This is how the UberSpector recognizes links. Note this is equally true for tokens and fields in Marketo, it’s not only about Velocity tokens.
    4. If you’re only using a $variable once, just include the entire link (from <a> through closing </a>) in the token.
    5. If you’re reusing a $variable in a loop, you need to use a workaround.

    1 reply

    SanfordWhiteman
    SanfordWhitemanAccepted solution
    Level 10
    January 28, 2026

    Please use the Insert Code feature for readability going forward. (Click the three dots on the button bar.)

     

    Anyway:

    1. Yes, you can output tracked links from Velocity tokens. We do it all the time.
    2. Where are you getting the idea there’s an $email tool in Marketo’s Velocity implementation?
    3. Marketo always expects the protocol (http:// or https:// to be a constant, not part of the variable. This is how the UberSpector recognizes links. Note this is equally true for tokens and fields in Marketo, it’s not only about Velocity tokens.
    4. If you’re only using a $variable once, just include the entire link (from <a> through closing </a>) in the token.
    5. If you’re reusing a $variable in a loop, you need to use a workaround.
    BenjincAuthor
    Level 2
    January 28, 2026

    As ever, an absolute legend, worked a treat

    Cheers Sanford!

    SanfordWhiteman
    Level 10
    January 28, 2026

    Great!