Skip to main content
Sally_Duda
Level 2
Oct 24, 2019 8:57 PM UTC
Solved

How do I use Velocity Scripting (Email Script Tokens) with email tracking query string parameters?

We have multiple unsubscribe pages. I use an email script token for my unsubscribe links so that I can select the unsubscribe token based on the email audience e.g. I use one token for the US, another for the EU and so on.  When someone clicks the unsubscribe link, I want to track that they unsubscribed from the email in the Email Performance report but I don't want to track the click in the Email Link Performance report.

The URL without Marketo email tracking tokens is:

https://www.conference-board.org/subscriptioncenter/?mid={{lead.Marketo ID}}

Adding the email tracking tokens:  "mkt_unsubscribe=1&mkt_tok=##MKT_TOK##" in the actual email works as desired.

HTML (this works):

<div>You are receiving this email based on your relationship or past engagement with The Conference Board on this topic. To manage your preferences or unsubscribe <a href="https://www.conference-board.org/subscriptioncenter/?mid={{lead.Marketo ID}}&mkt_unsubscribe=1&mkt_tok=##MKT_TOK##" class="mktNoTrack" target="_blank" style="color: #3fa7cc; text-decoration: none;">click here</a>.<br /></div>‍

Velocity Script (this doesn't work):

You are receiving this email based on your relationship or past engagement with The Conference Board on this topic. To manage your preferences or unsubscribe <a href="https://www.conference-board.org/subscriptioncenter/?mid=${lead.marketoID}&mkt_unsubscribe=1&mkt_tok=##MKT_TOK##" class="mktNoTrack" target="_blank" style="color: #3fa7cc; text-decoration: none;">click here</a>.‍

How can I get this to work within an email script token?

The URL in the email script is:

https://www.conference-board.org/subscriptioncenter/?mid={{lead.Marketo ID}}&mkt_unsubscribe=1&mkt_tok=##MKT_TOK##

The script does not add the link to "click here" unless I remove "&mkt_tok=##MKT_TOK##"

Note: I  checked the Person fields for Email Address and a custom field called Marketo ID in the token set up.

I looked at the Velocity Script documentation and am wondering if I need to escape the "#" sign.  However, it's not clear to me how to do that with two ## next to each other. I've tried different combinations with the "\" but  I don't think the examples are directly related to what I am trying to do. I'm not trying to implement inside a macro.

Any guidance would be appreciated .

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Oct 25, 2019 6:25 PM UTC

Sorry, I wasn't familiar with at the Advanced Editor / Syntax Highlighter button feature - it's under the More menu .

You are receiving this email based on your relationship or past engagement with The Conference Board on this topic. To manage your preferences or unsubscribe <a href="https://www.conference-board.org/subscriptioncenter/?mid=${lead.marketoID}&mkt_unsubscribe=1&mkt_tok=\##MKT_TOK##" class="mktNoTrack" target="_blank" style="color: #3fa7cc; text-decoration: none;">click here</a>.‍

OK, thanks. Solution here: nation.marketo.com/groups/newyork-user-group/blog/2019/10/25/emulating-mkttok-in-velocity 

10 replies

SanfordWhiteman
User Group Leader
User Group Leader
Oct 24, 2019 9:34 PM UTC

Can you pls delete that block of code and replace it with syntax highlighted Java (Java being the closest to VTL) using the Advanced Editor? I can't read it like that.

Translate
Sally_Duda
Level 2
Oct 25, 2019 3:02 PM UTC

Hi Sanford, many thanks for replying. I rewrote the questions. Hopefully it's a little clearer what I am trying to accomplish .

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Oct 25, 2019 5:11 PM UTC

Open the Advanced Editor mode, select the code, hit the Syntax Highlighter button and select Java.

Translate