There are many ways to customize content in Marketo, but one of the coolest ways I have found is using Marketo’s velocity scripting — more so being able to use velocity scripting to customize My.Tokens. What I’m talking about is Tokenception! Yes, you heard me right Tokenception – being able to put tokens inside of tokens.
While using velocity to add tokens inside of tokens is fantastic, there are a couple limitations — you can only use lead tokens – you cannot use system, program, or Tokens” inside the script.
In this example we will be creating a text token with a brief message to use throughout our program. But we also need to include the Person’s first name in the message, which is where we will add our velocity script token.
You will need to create:
- A program
- An email
- A “Text” token (See {{my.firstleveltoken:default=Friend}} below).
- An “Email Script” token (See {{my.nestScript}} below).
STEPS
1. Edit your message in the Text token,{{my.firstleveltoken:default=Friend}}. Wherever you want the velocity script token you will create a unique name prefaced with a “$”. In this sample we will be using “$Name”. Save your Text token.
Sample text Below
“How is it going, $Name? Are you ready for the webinar, May 12th?”
2. Next, edit your Email Script token. Select the field you will use for the Email Script token. Drag and drop it into the Edit Script Token window. Wrap your Email Script token with the code below to set the variable for “$Name”. Save your Email Script token.
Sample text Below
“#set($Name = ${lead.FirstName})”
3. Finally, place your Text token within your email, and test the output of your Email Script token within your Text token.
Congratulations, you know have personal content inside your tokens!
While this is one of my favorite things to do with velocity scripting it’s not the only thing it can do. Velocity can also perform mathematical calculations, manipulate data, format dates, and more.
To learn more, stay tuned in the coming weeks for a more in-depth blog on velocity scripting from Mckell Cousins. In the meantime, you can check out Marketo’s documentation on email scripting, Apache’s Velocity Scripting Docs, or you can Contact Us to create your personalized Velocity Scripts.