Skip to main content
Level 2
Aug 24, 2022 10:08 AM UTC
Solved

How to track velocity script link

Hi Team,

 

I am facing an issue in tracking a link which is coded in the velocity script. This link is generated from opportunity object, since I cannot use it directly in the email, I need a work around for it.  We thought velocity script is a work around but it is not working when the link is made trackable.

Kindly help.

 

Regards

Pavan

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Jon_Wright
Jon_WrightAccepted solution
Level 4
Aug 24, 2022 12:52 PM UTC

Would need more detail but sounds like potentially is related to the issue for outputting tracked links from a list. I recommend Sanford's excellent blog for all things Marketo + Velocity: https://blog.teknkl.com/multiple-marketo-tracked-links-in-velocity/

13 replies

Jon_Wright
Jon_WrightAccepted solution
Level 4
Aug 24, 2022 12:52 PM UTC

Would need more detail but sounds like potentially is related to the issue for outputting tracked links from a list. I recommend Sanford's excellent blog for all things Marketo + Velocity: https://blog.teknkl.com/multiple-marketo-tracked-links-in-velocity/

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Aug 24, 2022 8:26 PM UTC

As Jon notes, you may be running into the well-known problem with links built from multiple references to the same VTL variable.

 

But since you didn’t supply your Velocity code yet, it’s impossible to say.

Translate
Level 2
Sep 13, 2022 7:48 AM UTC

Hi Sanford,

 

Thank you very much for taking time to reply.  

The problem is we have a personalized URL that gets generated in SFDC and we want to use it in the email. We are able to use it using velocity token but unable to track the link.

I went through your blog and tweaked your code as per my requirement but it ain't working, I even tried hardcoding it in HTML itself but even that did not work. 

 

#set( $urlField = $OpportunityList.get(0).Repayment_Personalized_URL__c ) #set( $urlNoProto = $urlField.replaceAll("(?i)^https?://","") ) #if( $urlField.matches("(?i)^http://") ) <a href="http://${urlNoProto}">Go for it</a> #else <a href="https://${urlNoProto}">Go for it</a> #end

 

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Sep 13, 2022 5:44 PM UTC

Please remember to highlight your code, thanks (I fixed it for you).

 


I went through your blog and tweaked your code as per my requirement but it ain't working, I even tried hardcoding it in HTML itself but even that did not work. 

#set( $urlField = $OpportunityList.get(0).Repayment_Personalized_URL__c ) #set( $urlNoProto = $urlField.replaceAll("(?i)^https?://","") ) #if( $urlField.matches("(?i)^http://") ) <a href="http://${urlNoProto}">Go for it</a> #else <a href="https://${urlNoProto}">Go for it</a> #end

So you’re saying this code outputs a perfectly usable <a> tag (as it should) but the link is not rewritten to bounce off the branding domain? That’s strange indeed. What do you mean by “hardcoding it in HTML itself” exactly?

Translate