SOLVED

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

Go to solution
Jerry_Yi
Level 2

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

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.

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

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

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

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

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