AnsweredAssumed Answered

How can I use the ##MKT_TKN## from a custom email script?

Question asked by Angel Ordax on May 15, 2019
Latest reply on May 15, 2019 by Sanford Whiteman

We have 2 ways to unsubscribe users from our newsletters:

- From the Marketo page => For unregistered users

- From our main site => For users with an account


Until now we've been sending both types of users to the same Marketo page from our newsletter's footer but that is not ideal because users with an account are unable to see what they are subscribed to on that page as Marketo is unable to connect with our database. In an effort to improve that experience I've been trying to implement a custom email script that checks if the user's email is on our registered user's database and shows the right link for them.


So far so good. The problem is that the Marketo link to unsubscribe needs to contain ##MKT_TKN## and since the email script is written in Velocity that gets treated as a comment and therefore removed from the final output… I've tried using the methods described on Velocity's documentation to escape characters but for some reason they don't seem to work within Marketo. Here's my code in case anyone has an idea of what to do here:


## Check for UA users and show right newsletter options page
## {{memberLv}}

#if(${lead.member_level__c} == "")


I've tried many things without success. I've tried using variables to store the hashtag symbol but it only works when it's a single one. I've tried using getH() but again it just works with one. I also tried using the real name of the sign (#) but that renders the hashtag on the link's text but leaves the # on the URL making it crush…


I really need to get this working but I can't get my head around it, if anyone has any idea I would really appreciate it.