Guidance Needed: Using Rep Code from a Marketo Field to make it trackable | Community
Skip to main content
Level 4
January 29, 2026
Question

Guidance Needed: Using Rep Code from a Marketo Field to make it trackable

  • January 29, 2026
  • 1 reply
  • 10 views

Hi Team,

We have a field in Marketo that stores a Rep Apply Link, which contains a unique rep code. Our goal is to extract just that unique rep code and use it within other links so that when someone clicks or applies using that link, we can identify which rep they are associated with.

For example, we want to end up with a link structure like:
http://google.com/?rep={{rep-code}}

I have a few questions:

  1. Since the rep code would need to be dynamically generated per rep using a Velocity script, can we reference the resulting My Token directly in the email link? Or does the entire anchor tag need to be handled within Velocity to ensure the link both works correctly and remains trackable in Marketo? Like the custom object think we discussed a while ago ?

  2. For clarity, we’re also looking to understand how to extract just a specific portion of a field value. For example:

    • Apply Field value: https://www.abc.com/apply?rep=XXXXX

    • Desired output: https://www.yahoo.com?rep=XXXXX

    Essentially, we want to pull only the rep code (XXXXX) from the existing field and append it to different base URLs as needed.

  3. Based on best practices, should the full setup—including the link and anchor tags—be handled within the Velocity script, or is it recommended to keep the Velocity logic limited to generating the rep code and then reference it in the email content?

This is primarily to ensure the links are both functional and trackable, and that we can reliably capture rep attribution in activity logs.

Any guidance or recommended approach would be greatly appreciated.

Thanks in advance for your help,
Akshat

1 reply

SanfordWhiteman
Level 10
January 29, 2026

Assuming the rep param is only composed of non-reserved ASCII characters* use:

#set( $rep = $link.uri( $lead.urlField ).getParams().get("rep") )
<a href="https://www.example.com?rep=${esc.url($rep)}">Go get 'em</a>

You should always, with no exceptions, generate the entire link from Velocity.

 

* otherwise, you need to extend $link.uri a bit