Is it possible to use tokens in a URL?

Anonymous
Not applicable

Is it possible to use tokens in a URL?

Trying to do a campaign where the person's name is in the title. I tried to create a URL with {{lead.First Name}} but got an error. 

Does anyone know a way to make this work? 
Tags (1)
6 REPLIES 6
Josh_Hill13
Level 10 - Champion Alumni

Re: Is it possible to use tokens in a URL?

sure this should work in theory. You aren't really supposed to do this in URL because it might reveal personal info to others.

how exactly did you do this or what error did you get?
Anonymous
Not applicable

Re: Is it possible to use tokens in a URL?

You can certainly use tokens in a URL, and that is the proper syntax for First Name. What was the specific error that you received?

It could be either:

  1. An encoding issue depending upon where the URL is located. Often, spaces get translated to "%20".
  2. Malformed URL, e.g. of valid: http://www.domain.com/?first_name={{lead.First Name}}&last_name={{lead.Last Name}}
Josh_Hill13
Level 10 - Champion Alumni

Re: Is it possible to use tokens in a URL?

yeah, i bet the other Josh is right -spaces will break this...no good way around this.

Why do you want to do this anyway?
Anonymous
Not applicable

Re: Is it possible to use tokens in a URL?

Basically what I'm looking to do is create a URL like this: info.companyname.com/firstnamelastname.html

The error that I am getting is: A URL path may contain only letters, numbers, period, dash or underscore ('.-_')

We have a direct mail piece that we are trying to use and would like to be able use a name customized URL. 
SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to use tokens in a URL?

@Leah G Do you use Salesforce? If so you can create a formula field that saves the URL-encoded form of the Contact's full name.

You also can probably do this using Email Scripting.  The Velocity language has $esc.url( string ).

 
Anonymous
Not applicable

Re: Is it possible to use tokens in a URL?

@Leah G Where in Marketo are you building the URL? If you are building within an email template, I've seen issues with copy/paste. So you can go back in and modify the HTML to often fix issues. The following URL does work for me within an email template.

http://info.companyname.com/{{lead.First Name}}{{lead.Last Name}}.html