Solved
Email Script Token type in Unsubscribe
I'm trying to append the lead's language to unsubscribe html text via a token. Each piece seems to work correctly on its own. When I send a sample, the script inside of the token is just added to the end of the URL. My token is
#if(!$lead.language.isEmpty())
#if($lead.language.toLowerCase() == "english")
#set($LANG = "en" )
#else
#if($lead.language.toLowerCase() == "chinese")
#set($LANG = "cn" )
#else
#if($lead.language.toLowerCase() == "spanish")
#set($LANG = "es" )
#else
#if($lead.language.toLowerCase() == "portuguese")
#set($LANG = "pt" )
#else
#if($lead.language.toLowerCase() == "russian")
#set($LANG = "ru" )
#else
#set($LANG = "en")
#end
#end
#end
#end
#end
#else
#set($LANG = "en")
#end
$LANG
My Unsubscribe HTML is
<p style="background-color:#ffffff;"><div style="color: #4f4f4f; text-align: center; font-family: 'Gulfstream Horizon',Arial,sans-serif; font-size: 10.5px;">This email was sent to {{lead.Email Address}}<br><a style="color: #4f4f4f;" href="https://test.com/signup.html?mkt_tok=##MKT_TOK##&utm_source=marketo&utm_medium=email&utm_campaign={{my.campaign:default=mrk}}&{{program.name:default=na}}">Update preferences</a> | <a style="color: #4f4f4f;" href="%mkt_opt_out_prefix%UnsubscribePage.html?mkt_unsubscribe=1&mkt_tok=##MKT_TOK##&utm_source=marketo&utm_medium=email&utm_campaign={{my.campaign:default=mrk}}&{{program.name:default=na}}">Unsubscribe</a> | <a style="color: #4f4f4f;" href="https://test.com?lang={{my.Language}}&document=Privacy%20Notice">Privacy notice</a></div></p>