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

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

  • January 29, 2026
  • 1 reply
  • 35 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

Best answer by SanfordWhiteman

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

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
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

SanfordWhiteman
Level 10
February 3, 2026

@ashah123 did you see my reply?

ashah123Author
Level 4
February 9, 2026

@SanfordWhiteman

Apologies for the delay in my response—I was out of the office all of last week and just saw your message today. Thank you for the update.

I’ll test this during the week and get back to you with the results. I’ll also let you know if I run into any issues or need any additional support.

Thanks for your understanding, and apologies again for the delayed response.