SOLVED

Malformed Link Creation using Velocity Script

Go to solution
Jay00031987
Level 4

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
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

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
SanfordWhiteman
Level 10 - Community Moderator

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 )

 

Jay00031987
Level 4

thanks for the details but I am still facing the same issue. In email editor preview the correct value is displayed but as soon as I open the link from my inbox it is not working. 

Jay00031987_0-1647763044998.png

Jay00031987_0-1647763288109.png

 

 

Jay
Jo_Pitts1
Level 10 - Community Advisor

@Jay00031987,

what does the current code look like?

What is the link that you get in your inbox look like (just to confirm the problem hasn't changed along the way)

Cheers

Jo

Jay00031987
Level 4
#set( $UTM = $lead.encryptedID )
#set( $encryptedValue = $esc.url($UTM))
${encryptedValue}

above is the velocity code and inbox URL start with Domain Name/dcn/Marketo encrypted code

and the preview URL in email editor with specific person(jay00031987@xyz.com) based is http://www.google.com?UTM=niuwtv%2FX6QbChEVV46iplJEmx02eOtwqJzG%2Fnm9fmYouZwADkHr%2BMg%3D%3D 

and mktNoTok is being used in the hyperlink. 

Jay
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

I'm still getting the correct UTM parameter value in both the email preview and the actual email sent from Marketo.

 

E-mail preview tab

Darshil_Shah1_0-1647858133799.png

 

E-mail in the inbox of a test record

Darshil_Shah1_1-1647858158979.png

 

On clicking the CTA from E-mail

Darshil_Shah1_2-1647858178085.png

 

Are you adding the "?UTM=" directly in the URL editor in Marketo?

Jay00031987
Level 4

Yup! please refer below image

Jay00031987_0-1647869238100.png

Also, I see the given example for your URL is not converting + sign in %20 but when we use the velocity token it does. it look like you are not using velocity token in the URL. are you using lead token only in UTM?  

Jay
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

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

Darshil_Shah1_0-1647871457570.png

 

Jay00031987
Level 4

It look like same approach is working at your system but in my system I am facing issue. does Adobe support can help to sort this issue?

Jay
SanfordWhiteman
Level 10 - Community Moderator

It look like same approach is working at your system but in my system I am facing issue. does Adobe support can help to sort this issue?

Doubtful (though not impossible) that your system is behaving differently.

 

Earlier you said you’d added class mktNoTok to the link. You want mktNoTrack.

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

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.

EllenSchwier
Level 5

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.

Jay00031987
Level 4

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
SanfordWhiteman
Level 10 - Community Moderator

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.

Jo_Pitts1
Level 10 - Community Advisor

@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

Yes. It is selected

Jay
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

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

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