Marketo Tokens in Email Templates - How to Hard Code a Date

Liz_Davalos
Level 3

Marketo Tokens in Email Templates - How to Hard Code a Date

This is a weird, but frustrating issue. Marketo tokens with velocity scripts don't work if they are plugged into an email template rather than the Email Editor. I wanted to hard code a send date for my UTM tags since otherwise everyone seems to either not set it or come up with some random date format. Normal, non-custom tokens seems to work just fine, but not ones based on a script.

Token: {{my.YYMMDD}}

Velocity Script: $date.get('yy_M_d')

Works if added in Email Editor 2.0

Does not work if put into email template (it changes in the url string to ${my.vYYMMDD_1})

I'm wondering if anyone knows a way around this? Some way to format the {{system.date}} to be Google UTM friendly (no spaces).

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Tokens in Email Templates - How to Hard Code a Date

You need to make sure you're emitting the entire fully-formed <a> tag from the Velocity token.  You can't reliably interpolate a Velocity {{my.token}} into an <a> that's outside of Velo.

Also: don't use Date or Calendar objects in Velocity without using a timezone. It'll cause subtle breakage. See here for some guidelines: http://blog.teknkl.com/velocity-days-and-weeks/

Liz_Davalos
Level 3

Re: Marketo Tokens in Email Templates - How to Hard Code a Date

In this instance there is no <a> tag, just a text date generated by the script. I didn't know about that timezone issue though so I'll try that and see if it starts working.

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Tokens in Email Templates - How to Hard Code a Date

Yes, try it with the proper tz awareness.

Also I'd recommend using ISO standard yyyy-MM-dd, as that can be parsed by any programming language as need be.