SOLVED

Decorate link from a URL type field

Go to solution
Michael_Florin
Level 10

Decorate link from a URL type field

Hello!

We have a field in Marketo of the type URL. The values in that field are full URLs, like: https://www.timetrade.com/app/....

If I want to bring these URLs into emails using the token like that:

<a href="{{lead.SFDCLeadOwnerTimeTradeURL}}">

that link doesn't get decorated = redirected = tracked. I know, it's because the "https://" part of the link is in the token and not on the email as it should. Is there any way I can have this link decorated nonetheless?

Thanks!

Michael

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Decorate link from a URL type field

Mmm, glad that did it! But emitting the Velocity reference (${urlshort)) directly in the email is not supported (it's an artifact of Marketo's use of Velocity in general, even without userland tokens).

I did mean having the Velocity token emit the whole <a>.  Try it with the three lines directly in the token, then include the {{my.token}} name.

#set( $url = $lead.SFDCLeadOwnerTimeTradeURL )

#set( $urlshort = $url.replace( "https​://", "") )

<a href="http​s://${urlshort}">schedule a time</a>

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Decorate link from a URL type field

You can use Velocity to emit a fully-formed <a> link based on that field and it will be tracked. This is a good/necessary workaround when fields can't be stopped from including a full URL.

Michael_Florin
Level 10

Re: Decorate link from a URL type field

Thanks Sanford!

Disclaimer up front: I don't really speak Velocity. I'm just a rather oblivious user.

But that said:

<a href="${lead.SFDCLeadOwnerTimeTradeURL}">Just add a date on my calendar</a>

This string from my script token does not return a decorated link. But with "emit a fully-formed <a> link", I suppose you mean something like this:

#set( $url = "${lead.SFDCLeadOwnerTimeTradeURL}" )

#set( $urlshort = $url.replace("https://", "") )

and putting

<a href="https://${urlshort}">schedule a time</a>

on the email. That indeed works fine.

SanfordWhiteman
Level 10 - Community Moderator

Re: Decorate link from a URL type field

Mmm, glad that did it! But emitting the Velocity reference (${urlshort)) directly in the email is not supported (it's an artifact of Marketo's use of Velocity in general, even without userland tokens).

I did mean having the Velocity token emit the whole <a>.  Try it with the three lines directly in the token, then include the {{my.token}} name.

#set( $url = $lead.SFDCLeadOwnerTimeTradeURL )

#set( $urlshort = $url.replace( "https​://", "") )

<a href="http​s://${urlshort}">schedule a time</a>

Michael_Florin
Level 10

Re: Decorate link from a URL type field

Thanks again, Sanford. Got it. Did it - works beautifully!

SanfordWhiteman
Level 10 - Community Moderator

Re: Decorate link from a URL type field

Great!