SOLVED

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

Go to solution
Sally_Duda
Level 2

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 .

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

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

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.

Sally_Duda
Level 2

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

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

SanfordWhiteman
Level 10 - Community Moderator

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

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

Sally_Duda
Level 2

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

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>.
SanfordWhiteman
Level 10 - Community Moderator

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

Sally_Duda
Level 2

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

Awesome. Thanks so much Sanford!

cslater
Level 2

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

It's been a couple of years and that link is dead and I'm having the same issue. Is there a new link to this solution or can someone provide the solution here?

SanfordWhiteman
Level 10 - Community Moderator

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

cslater
Level 2

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

When I go to that link I get this error message:
https://share.getcloudapp.com/p9uA0jdA