SOLVED

Malformed Link Creation using Velocity Script

Go to solution
Jay00031987
Level 4

Malformed Link Creation using Velocity Script

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) 

Jay
1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Malformed Link Creation using Velocity Script

Thanks for sharing that! I’m not referencing any lead token in the link - just the velocity token.

Darshil_Shah1_0-1647871457570.png

 

View solution in original post

17 REPLIES 17
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Malformed Link Creation using Velocity Script

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.

Jay00031987
Level 4

Re: Malformed Link Creation using Velocity Script

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.     

Jay
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Malformed Link Creation using Velocity Script

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.

Darshil_Shah1_1-1647444668195.png

 

 

 

Jay00031987
Level 4

Re: Malformed Link Creation using Velocity Script

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. 

 

Jay00031987_0-1647762798776.png

 

Jay
Jo_Pitts1
Level 10 - Community Advisor

Re: Malformed Link Creation using Velocity Script

@Jay00031987 ,

silly question - have you ensured that the encryptedID field is checked in the object tree on the RHS of the script editor?

Cheers

Jo

Jay00031987
Level 4

Re: Malformed Link Creation using Velocity Script

Yes. It is selected

Jay
SanfordWhiteman
Level 10 - Community Moderator

Re: Malformed Link Creation using Velocity Script


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.

EllenSchwier
Level 5

Re: Malformed Link Creation using Velocity Script

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.

SanfordWhiteman
Level 10 - Community Moderator

Re: Malformed Link Creation using Velocity Script

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 )