Using Velocity Script to Set URL (and leave out formatting)

mkmarketo1
Level 2

Using Velocity Script to Set URL (and leave out formatting)

Hello, 

I am trying to set a URL in velocity script based on lead data. I do not want to pass any CTA copy in the velocity, how can I set URLs without putting the URLs in a tags? We will be using these links in multiple places in the email, so simply want to pass the URL only, no other formatting. I have not been able to get this work. 

-------------------------------

EXAMPLE 1: 

#if($lead.Language=="English")#set($ctalink="test.com")



#elseif($lead.Language=="Spanish")#set($ctalink="test.com/spanish")



#elseif($lead.Language=="Japanese")#set($ctalink="test.com/japanese")

#end

##print

https://$ctalink

 

-NOTES: Tracking for links are broken in this example, tracking does not show up on lead record or report

-----------------------------

EXAMPLE 2: 

#if($lead.Language=="English")#set($ctalink="test.com")



#elseif($lead.Language=="Spanish")#set($ctalink="test.com/spanish")



#elseif($lead.Language=="Japanese")#set($ctalink="test.com/japanese")

#end

##print

$ctalink

-NOTES: Links break once the email is sent.

----------------------------

 

How can I pass just the URL from velocity without breaking tracking?

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Using Velocity Script to Set URL (and leave out formatting)

As before, please edit your post to use the Syntax Highlighter so the code is readable.

 

Broadly, what you’re trying to do is impossible. You need to output full links from Velocity.

mkmarketo1
Level 2

Re: Using Velocity Script to Set URL (and leave out formatting)

Thanks for the reply, so outputting the full link will enable tracking? I tried that and don't see on lead record or report.

 

 

#if($lead.Language=="English")#set($ctalink="https://test.com")

#elseif($lead.Language=="Spanish")#set($ctalink="https://test.com/spanish")

#elseif($lead.Language=="Japanese")#set($ctalink="https://test.com/japanese")

#end

##print

$ctalink

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Using Velocity Script to Set URL (and leave out formatting)

By “link” I mean the entire HTML <a> tag (this is in the “links” collection in HTML).

 

Not only the href.

 

As always, the full <a> through </a> need to be output via Velocity.