Hi Community!
We want to send personalized content recommendations to our users and upload HTML snippets for each one via API into a textarea token on Marketo. But, we're wondering how we can track link clicks inside this token. Here's an example of the snippet we'll have in the textarea box (remember, this will vary for each user):
<a href="https://123.com">Link 1</a> <br />
<a href="https://1234.com">Link 2</a> <br />
<a href="https://1235.com">Link 3</a> <br />
Any ideas on how to make this work? Thanks!
Solved! Go to Solution.
You can only do this if you pre-process the field via Velocity. That is, don’t output the {{lead.token}} directly, create a Velocity token that parses it and creates new output with the links.
However, to go this route, you don’t want to include actual HTML since Velocity doesn’t have an HTML parser. Instead you’d include JSON, which is parseable:
[
{
"text" : "Link 1",
"hrefNoProto" : "1234.com"
},
{
"text" : "Link 2",
"hrefNoProto" : "4567.com"
},
{
"text" : "Link 3",
"hrefNoProto" : "6789.com"
}
]
Parsing JSON in Velocity is covered in a lot of past posts.
Note there’s no reason to include the protocol in the JSON because you have strip it out anyway.
Your questions sounds as if you knew that this is not supposed to work, right?
https://nation.marketo.com/t5/knowledgebase/how-to-track-tokenized-links-in-email-assets/ta-p/254486
So no, I don't have an immediate idea. You might want to reconsider your process if you really need that link tracking.
You can only do this if you pre-process the field via Velocity. That is, don’t output the {{lead.token}} directly, create a Velocity token that parses it and creates new output with the links.
However, to go this route, you don’t want to include actual HTML since Velocity doesn’t have an HTML parser. Instead you’d include JSON, which is parseable:
[
{
"text" : "Link 1",
"hrefNoProto" : "1234.com"
},
{
"text" : "Link 2",
"hrefNoProto" : "4567.com"
},
{
"text" : "Link 3",
"hrefNoProto" : "6789.com"
}
]
Parsing JSON in Velocity is covered in a lot of past posts.
Note there’s no reason to include the protocol in the JSON because you have strip it out anyway.