Email ID System Token

Email ID System Token

Being able to auto-populate the email ID in emails by making a {{email.id}} system token available, similar to {{program.id}} and {campaign.id}}

17 Comments
SanfordWhiteman
Level 10 - Community Moderator

Well of course... the code sets the variable to the value, I wouldn't have any idea how you wanted to output it.

kh-lschutte
Community Manager
Status changed to: Already have it
 
Keith_Nyberg2
Level 9 - Champion Alumni

@SanfordWhiteman - This process works very elegantly in the body of the email but for some reason when I try to add the token as an additional parameter in a link URL path is does not return the correct value. My assumption is that it's due to the velocity not being able to return the value in a URL. Any insight into method that would enable me to append the email asset ID in an email link as a parameter?

Example: https://www.mysite.com/?utm_campaign={{my.emailID}}

SanfordWhiteman
Level 10 - Community Moderator

Well, using Velocity output as part of links isn’t generally supported. Instead, output the whole link including the <a> and </a> from Velocity,

Keith_Nyberg2
Level 9 - Champion Alumni

I assume that means I would have to put the link in the velocity token to render the full path, correct? Would you be able to show me an example of how the velocity would be modified to return the whole link? Again, my hope is for a method to add that ID where I see fit email by email so storing the full url path in the velocity token may not always work. If I have to do that it almost seems easier to create a text token called {{my.emailId}} and jus have me users set the value when creating the program... which is easy for programs where there is only 1 email but more challenging when there are multiple emails in a program (although I could use more tokens). Dreaming of a one size fits all approach but might be just that... a dream.

Keith_Nyberg2
Level 9 - Champion Alumni

@SanfordWhiteman can the velocity token access other {{my.token}} values? For example, if I have a {{my.CTA URL}} set. Could the velocity token use that value to generate a full URL and output:
{{my.CTA URL}}?utm_source=marketo&utm_medium=email&utm_campaign={{program.name}}{{my.emailID}}

{{my.CTA URL}} being a program text token
?utm_source=marketo&utm_medium=email&utm_campaign= being a hardcoded value in the velocity output
{{my.emailID}} being the asset ID generate by the velocity script mentioned in this thread

If so, I believe we could automate never having to set utms for emails with 1 CTA ever again... this doesn't solve situations where there are multiple links in the email though unfortunately but would solve alot of simple predefined use cases.

SanfordWhiteman
Level 10 - Community Moderator

I would have those tokens be Velocity {{my.tokens}}. Then each can access any $variables set in earlier tokens.