AnsweredAssumed Answered

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

Question asked by Sally Duda on Oct 24, 2019
Latest reply on Oct 25, 2019 by Sally Duda

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 .

Outcomes