AnsweredAssumed Answered

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

Question asked by Jerry Yi on May 30, 2017
Latest reply on May 30, 2017 by Sanford Whiteman

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:




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






In email template:

<a href="{{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.