Velocity scripting - passing a value to query string param in email | Community
Skip to main content
Jerry_Yi
New Participant
May 30, 2017
Solved

Velocity scripting - passing a value to query string param in email

  • May 30, 2017
  • 1 reply
  • 2632 views

Haven't been able to find anything on this (or most likely haven't been searching correctly), but recently ran into something unexpected when trying to use scripting to dynamically set a UTM param value.

The setup:

My token:

Name:

{{my.utm_term}}

Script:

#if (${lead.Segmentation_Plan_1002} == "Asclepius" || ${lead.Segmentation_Plan_1002} == "Default")

lead

#else

upgrade

#end

In email template:

<a href="marketo.landingpage.com/pagename.html?utm_term={{my.utm_term}}">

When previewing the email above, the URL in the preview shows up correctly where {{my.utm_term}} is replaced correctly with either "lead" or "upgrade". However, it doesn't work at all when clicking from a sent sample email. Instead the value shows up as "${my.vUTM_TERM_4645}" where the last 4 digit number changes between emails as well.

Not sure how to get this to work correctly or why it's showing up this way in the email send but not on the preview.

My workaround:

Instead of passing "lead" or "upgrade", I just constructed the full anchor tag in my token script and replace the anchor tag in the email with the token.

Best answer by SanfordWhiteman

Not so much a workaround as the only supported method. Always output fully-formed <A>s from VTL.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
May 30, 2017

Not so much a workaround as the only supported method. Always output fully-formed <A>s from VTL.