SOLVED

Re: Add EmailID and Link ID to UTM string

Go to solution
Tom_Elliott
Level 1

Add EmailID and Link ID to UTM string

Hi,

I'd like to programmatically identify which email and link a person clicks and include that information in the UTM string of the link of the email. Is this possible in Marketo? Maybe with a token or velocity script?

 

For example,  if there were tokens for "email" and "link", I'd like to have the HTML of the link in my email look something like "utm_campaign={{email.id}}&utm_content={{link.id}}". If the email ID in marketo is 1234 and the link ID is 5678, I'd want the final link to contain "utm_campaign=1234&utm_content=5678".

 

I'm just making up tokens in my example above. I don't see anything like this in the documentation. I could pull email ID from the email after I create it but would like to automate that if possible. "Link ID" - I'm not sure if this is a real piece of data marketo generates. I would like a way to differentiate which link in the email  a user is clicking that I can send to GA.

 

Thanks for any thoughts!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Add EmailID and Link ID to UTM string

The Email ID can be extracted using Velocity (search my past posts for how).

 

Since this assumes you’d be using Velocity to output the whole link, then by definition you’d also be able to output the Link ID as well, i.e.

#set( $linkId = 5678 )
<a id="${linkId}" href="https://www.example.com/page.html?linkId=${linkId}">Click here</a>

 

But without using Velocity tokens, this wouldn’t be possible.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Add EmailID and Link ID to UTM string

The Email ID can be extracted using Velocity (search my past posts for how).

 

Since this assumes you’d be using Velocity to output the whole link, then by definition you’d also be able to output the Link ID as well, i.e.

#set( $linkId = 5678 )
<a id="${linkId}" href="https://www.example.com/page.html?linkId=${linkId}">Click here</a>

 

But without using Velocity tokens, this wouldn’t be possible.

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Add EmailID and Link ID to UTM string

Below VTL adds the email asset id to the CTA's UTM in the utm_campaign parameter. You can include the email script token where you want to display the link in the email.

 

#set( $AssetId = $mktmail.xMarketoIdHdr.split(":")[5] )
<a href="https://www.example.com?utm_campaign=${AssetId}" target="_blank" id="TESTVEL">Recording Link</a>

 

We usually use the program name in the utm_campaign parameter though.