Hi,
New to Marketo. I'd like to insert code in my html for emails that includes the lead's first name in a greeting. Is Velocity the correct thing to use? Does all the #, $ and such used in it go directly into my html code? I found some Velocity code for this someone had posted and I copied and pasted it into a test and but it shows an error "Marketo does not allow javascript or script tags in email HTML".
Velocity tokens are a form of {{my.token}}. You create an Email Script {{my.token}} (a.k.a. "Velocity token" since the language supported is VTL).
Then you build the code in the Script Editor -- make sure you check off the fields you'll be using in the tree on the right-hand-side, since otherwise they won't be present in the Velocity context -- and put the name of the {{my.token}} in the email. Then the output of the Velocity code appears in the email content at the point of insertion.
The place for Marketo-specific Velocity pointers is https://blog.teknkl.com/tag/velocity/. Recommend you graze over all of those if you're getting started, then post back with follow-up questions.
Thank you for your quick and detailed reply. I appreciate it. It seems a lot of what I find is more advanced people looking to really fine tune a set of steps using Velocity for a token.
There must be an easy (relatively) way to create a script with Velocity to simply say "Dear FirstName", yes? That is all I"m looking to do. Its so simple to insert the token using the {{:}} option in some boxes but we're not using that. We're using 100% custom HTML. Our designer (who knows nothing about Velocity and tokens either) provides me the code and I dump it into a blank template. So I'm looking to pop the Dear FirstName code into that.
That would be the correct method, yes? After I create the email script token, add the First Name from the tree, then click the edit and build the script. I take that script and pop it into the html?
If it's always the same structure why would you not use
Dear {{lead.First Name}}
?
Velocity is for creating different content depending on the value of lead field(s). If you're just outputting the field value you don't need Velocity. In other words, there's no advantage to having a one-line Velocity token with
Dear ${lead.FirstName}
(and then embedding the name of the Velocity [{my.token}}) over just using the lead token.
Makes sense to me. When I put Dear {{lead.First Name}} in my content I get a message that say "Marketo does not allow javascript or script tags in email HTML". Even when I put this into emails that I know were 100% ok previously. So this error has to be from Dear {{lead.First Name}}. So I thought I had to use Velocity to create the script.
No need for a "script" at all here.
Please show the HTML of this email and where you're placing the lead token. Choose XML from the Syntax highlighting menu in Advanced Editor to highlight HTML in your messages here.
The warning from Marketo is if you have literal HTML <script> tags in the email. While it's true that you can bypass that error by injecting script tags via a Velocity token -- something that's necessary in some circumstances I won't get into now -- that's way off-topic for just inserting the First Name.