How to track velocity script link | Community
Skip to main content
Level 2
August 24, 2022
Solved

How to track velocity script link

  • August 24, 2022
  • 2 replies
  • 5573 views

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.
Best answer by Jon_Wright

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/

2 replies

Jon_Wright
Jon_WrightAccepted solution
Level 4
August 24, 2022

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/

SanfordWhiteman
Level 10
August 24, 2022

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.

Level 2
September 13, 2022

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

 

SanfordWhiteman
Level 10
September 13, 2022

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?