SOLVED

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

Go to solution
Angel_Ordax
Level 2

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

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} == "")
https://pages.devex.com/manage-email-preferences.html?newsletter=newswire&mkt_unsubscribe=1&mkt_tok=##MKT_TOK##
#else
https://www.devex.com/account/newsletters
#end



‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

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.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

Yes, always output full <a> tags, up to and including the closing </a>, from Velocity.

View solution in original post

2 REPLIES 2
Angel_Ordax
Level 2

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

[SOLVED]
I found a way myself, in the end, instead of just putting the link on the script I put the whole anchor tag and that solved

SanfordWhiteman
Level 10 - Community Moderator

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

Yes, always output full <a> tags, up to and including the closing </a>, from Velocity.