Hi ,
Hope all are doing well.
We've been tasked with personalizing the order ID within a URL. I've successfully used a script to personalize the order ID, and it's updating correctly. However, when I include this token within a URL, the URL breaks. URL doesn't work as expected and displays the script within the link.
In the email template, I've hardcoded the https:// part, while the rest of the URL and the personalization are stored in a token. This token, containing the personalized information, is then appended to the https:// portion.
However, when I included the https:// part directly in the script and used the token within the mailer, the URL worked smoothly. Unfortunately, that particular link lacked trackability.
Script :
#set($myProtectcode = $lead.protectedCodes_c)
#if($myProtectcode.contains(","))
#set($values = $myProtectcode.split(","))
#set($firstValue = $values.get(0))
#set($dynamiclink="xyz.html?Oid=$firstValue&src=email")
$dynamiclink
#else
#set($dynamiclinknew="xyz.html?Oid=$myProtectcode&src=email")
$dynamiclinknew
Kindly help.
Thanks & Regards,
Solved! Go to Solution.
The code is redundant, you can split regardless of whether the delimiter exists.
#set( $myProtectcode = $lead.protectedCodes_c )
#set( $values = $myProtectcode.split(",") )
#set( $firstValue = $values.get(0) )
#set( $trimmedvalue = $firstValue.trim() )
<a href="https://abc.adobeaemcloud.com/in/en/forms/nps-form.html?Oid=$trimmedvalue&src=email" target="_blank"><img src="https://abc/images/banner.jpg?version=1" style="display: block !important; margin: 0 auto !important;" class="responsive-image1"></a>
You should be outputting the entire link, from <a> to </a>, from the code. (This is discussed in many past threads!)
Thanks for the reply.
I attempted the script as per your suggestion, passing the entire <a> tag. Now its redirecting the URL but without personalizing the Order id value. It's transferring "Oid=$trimmedvalue" directly as it is in the URL.
#set($myProtectcode = $lead.protectedCodes_c)
#if($myProtectcode.contains(","))
#set($values = $myProtectcode.split(","))
#set($firstValue = $values.get(0))
#set($trimmedvalue = $firstValue.trim())
<a href="https://abc.adobeaemcloud.com/in/en/forms/nps-form.html?Oid=$trimmedvalue&src=email" target="_blank"><img src="https://abc/images/banner.jpg?version=1" style="display: block !important; margin: 0 auto !important;" class="responsive-image1"></a>
#else
<a href="https://abc.adobeaemcloud.com/in/en/forms/nps-form.html?Oid=$myProtectcode&src=email" target="_blank"><img src="https://abc/images/banner.jpg?version=1" style="display: block !important; margin: 0 auto !important;" class="responsive-image1"></a>
#end
Please advise.
Thanks & Regards,
The code is redundant, you can split regardless of whether the delimiter exists.
#set( $myProtectcode = $lead.protectedCodes_c )
#set( $values = $myProtectcode.split(",") )
#set( $firstValue = $values.get(0) )
#set( $trimmedvalue = $firstValue.trim() )
<a href="https://abc.adobeaemcloud.com/in/en/forms/nps-form.html?Oid=$trimmedvalue&src=email" target="_blank"><img src="https://abc/images/banner.jpg?version=1" style="display: block !important; margin: 0 auto !important;" class="responsive-image1"></a>
Hi @SanfordWhiteman ,
Now the code is working fine. Its personalizing the order id value in URL but the link is not trackable.
How to achieve it ?
Thanks & Regards,
Link tracking issue got resolved now. I hardcoded the "https://" part in emailer and removed this from script while creating dynamic link.
Thanks for your help @SanfordWhiteman 🙂
Regards,
Hmm, that’s actually not a supported method and isn’t necessary. Output from Velocity is the only way guaranteed to never break. Not sure why you’d be struggling with that, your code works for me.