Email ID System Token | Community
Skip to main content
November 16, 2017
Duplicate

Email ID System Token

  • November 16, 2017
  • 8 replies
  • 10218 views

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}}

8 replies

SanfordWhiteman
New Participant
March 19, 2024

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

keithnyberg
New Participant
March 19, 2024

@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.

keithnyberg
New Participant
March 14, 2024

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.

SanfordWhiteman
New Participant
March 14, 2024

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

keithnyberg
New Participant
March 14, 2024

@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: mysite.com/?utm_campaign={{my.emailID}}

New Participant
February 4, 2020
No text available
Bianca_Corey
New Participant
May 17, 2019

Hey - this was SO helpful. It solved our business problem.

However, it took referencing the token name again in the velocity script in order to populate. See here:

#set( $emailId = $mktmail.xMarketoIdHdr.split(":")[5] )
${emailId}

This worked!

SanfordWhiteman
New Participant
May 17, 2019

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

keithnyberg
New Participant
November 27, 2017

Hey Anthony,

Can you elaborate on what you mean by email ID? Marketo has a couple tokens that could help here. A few listed below.

Email Address: {{lead.Email Address}}

Lead ID: {{lead.ID}} <- # that is shown in the record domain

     (Ex//: marketo.com/leadDatabase/loadLeadDetail?leadId=9611899)

How does the value you are asking for differ from what is available? Can you explain the use case?

Sincerely,

Keith Nyberg

December 4, 2017

Sorry, I probably should have worded it differently.  I mean the asset id.  Each email asset has its own 'id" similar to how a program or campaign does.  But we are not able to dynamically pull that ID using a token unlike the program id and campaign id.  This seems weird to me because when you get bulk exports of activity/email data, they are broken out by email id. 

SanfordWhiteman
New Participant
December 4, 2017

In Velocity:

  #set( $AssetId = $mktmail.xMarketoIdHdr.split(":")[5] )

FYI.