1 Reply Latest reply on May 30, 2017 12:44 PM by Sanford Whiteman

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

    Jerry Yi

      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="https://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.