Business requirement is to add specific URL in the email assets including UTM parameter field. However, there are two different velocity script created in which one of them need to add the URL within the Velocity token and this link does not create Malformed Link refer below code
#set( $UTM= ${lead.encryptedID} )
#set( $url = "https://www.google.com" )
#set( $encryptedValue = $esc.url($UTM))
#set( $encryptedURLPrefill = $url + "?UTM=" + $encryptedValue)
${encryptedURLPrefill}
Below OUTPUT URL is working fine
http://www.google.com?UTM=niuwtv%2FX6QbChEVV46iplJEmx02eOtwqJzG%2Fnm9fmYouZwADkHr%2BMg%3D%3D
But, business need is to take out the URL from velocity token and use only UTM parameter via velocity token. In that case, Malformed Link is being created and traced in Email Link Performance report. refer below code
#set($UTM= ${lead.encryptedID})
#set($url = "dummy text")
#set($encryptedValue = $esc.url($UTM))
${encryptedValue}
did anyone faced this issue for Malformed Link Creation using Velocity Script what can be best way to resolve this issue?
malformed link example
https://www.google.com/set(%20$UTM%20=%20$%7Blead.encryptedID%7D%20)
Solved! Go to Solution.
Thanks for sharing that! I’m not referencing any lead token in the link - just the velocity token.
Hey, couple of notes for both the velocity script snippets below:
Script - 1
#set( $UTM= ${lead.encryptedID} ) #set( $url = "https://www.google.com" ) #set( $encryptedValue = $esc.url($UTM)) #set( $encryptedURLPrefill = $url + "?UTM=" + $encryptedValue) ${encryptedURLPrefill}
Below OUTPUT URL is working fine
http://www.google.com?UTM=niuwtv%2FX6QbChEVV46iplJEmx02eOtwqJzG%2Fnm9fmYouZwADkHr%2BMg%3D%3D
The URL added via the above script will not be tracked in Marketo. More on tracking URLs added via velocity here.
Script - 2
#set($UTM= ${lead.encryptedID}) #set($url = "dummy text") #set($encryptedValue = $esc.url($UTM)) ${encryptedValue}
did anyone faced this issue for Malformed Link Creation using Velocity Script what can be best way to resolve this issue?
malformed link example
https://www.google.com/set(%20$UTM%20=%20$%7Blead.encryptedID%7D%20)
You can either output the entire URL (<a> through closing </a>) using the email script - this way you'll be able to track the activities on the URL given that you include the protocol outside of variable in the anchor tag, or use the existing script and include the class="mktNoTrack" in the HTML of your link, however this'll disable the tracking on this link. Also, I don't think you need to set the $url variable here, if you aren't using it anywhere.
Refer this community article.
Hi @Darshil_Shah1 ,
I did the html changes and used class="mktNoTrack" but the link is still not correct it is displaying as same https://www.google.com/set(%20$UTM%20=%20$%7Blead.encryptedID%7D%20)
my first objective is to generate the correct URL and ignoring the fact that if link is outside of velocity scripts it will be not traced in Marketo. However, it can be checked in third party tool like GA.
I'm unable to replicate this at my end! I get the correct UTM params updated in the email and in the browser upon click. The value for the abc UTM parameter is populated from a lead token. Where are you appending the "?UTM=" in the URL? I don't see that in the URL shared by you.
Refer below screenshot you can see in the preview at the bottom the URL is displaying correct value but when email is delivered it is not working as expected in preview section.
silly question - have you ensured that the encryptedID field is checked in the object tree on the RHS of the script editor?
Cheers
Jo
Yes. It is selected
my first objective is to generate the correct URL and ignoring the fact that if link is outside of velocity scripts it will be not traced in Marketo. However, it can be checked in third party tool like GA.
GA will not help you track Munchkin session activities to the original recipient. Yes, any URL that leads to a page w/GA can be tracked anonymously.
I had a similar problem last year and this was the solution. I needed to define the text to be linked and output the linked text (not just the link itself) via Velocity.
n.b. you shouldn’t use the curly braces here (though it would not cause the behavior you’re describing):
#set( $UTM = ${lead.encryptedID} )
instead do:
#set( $UTM = $lead.encryptedID )