SOLVED

Email script token inside link

Go to solution
Kevin_Stinson
Level 3

Email script token inside link

Hello

I am trying to add part of the url to a link using an email script token to determine if the user is an investor or advisor to server up the correct page.

Here is the token:

#if(${lead.contacttype}=="Adviser")
adviser
#else
investor
#end

I also tried this way for the token:

#if(${lead.contacttype} == "Adviser")
#set($investor_type_link = "adviser")
#else
#set($investor_type_link = "investor")
#end
${investor_type_link}

 and this way after reading an article from Sanford:

#define( $buffer )
#if(${lead.contacttype} == "Adviser")
#set($investor_type_link = "adviser")
#else
#set($investor_type_link = "investor")
#end
#end
#set( $void = $buffer.toString() )
${investor_type_link}

Here is how it is implemented in the email:

<a href="https://www.xyzcompany.com/{{my.UK-investor-type-url}}/blogs-details?contentPath=en-gb/blog-posts/emerging-markets-end-2019-on-a-high-note&amp;utm_medium=email&amp;utm_source=Marketo&amp;utm_campaign=blog&amp;bps=bpspg" target="_blank" title="Read more">Read blog</a>

 

The URL when it is clicked on in the email looks like this or with one of the above token scripts. It has the correct value (investor), but it adds the extra content in red and is not targeting the page:

https://www. xyzcompany.com/investor/?mkt_tok=eyJpIjoiTXpJMk5qZzVaRFJsWW1VMSIsInQiOiIwc2pzWnNnd0RRYjhENHBMZE1kSW5cL3VsYklUOGZwWk9jNjFhbXkrUjViWCs3XC9iNUZxV2EwM3U4WndIZld0T29COVV1T2xnMDB1ZUtOcDZlWnNScldnPT0ifQ%253D%253D#define(%20$buffer%20)#if(${lead.contacttype}%20==%20%22Adviser%22)#set($investor_type_link%20=%20%22adviser%22)#else#set($investor_type_link%20=%20%22investor%22)#end#end#set($void%20=%20$buffer.toString())${investor_type_link}/blogs-details?contentPath=en-gb/blog-posts/emerging-markets-end-2019-on-a-high-note&utm_medium=email&utm_source=Marketo&utm_campaign=blog&bps=bpspg

 

Note: when I hover over the link in Marketo's preview it looks correct.

 

I have about 11 articles in each email and did not want to create 11 tokens with the full URL. Also this same email will go out monthly with different links each month.

 

Any help would be appreciated,

Kevin.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token inside link

You need to output the entire link (opening <a> through closing </a>) from the token.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token inside link

You need to output the entire link (opening <a> through closing </a>) from the token.

Kevin_Stinson
Level 3

Re: Email script token inside link

Thanks I guess then I will need 11 tokens each month.