Personalising hyperlinks outside the actual link
In a recent post, we told you about how hyperlinks in emails are no longer substituted by the pic.vicinity domain, and look a lot more like the original web address instead. Of course, this makes the link look safer to recipients. On top of that, this change in our system has brought another very fortunate side effect: personalising hyperlinks has gotten a lot less tedious.
A brief example
In the following two lines of template code, we first assign a profile value to the variable profileURL
. Then, this variable is called in the <a>
-tag.
{capture assign="profileURL"}{$profile.customurl}{/capture}
<a href="{$profileURL}">Click to claim your prize</a>
It looks like valid code, which it is. Previously, however, recipients would still see an empty link in this case. The reason for this was that the two lines of code above were executed at different moments in time. The only workaround for this was to include the entire code, including iterations and if-statements, in the hyperlink. As you'll have guessed, this lead to messy and unsustainable templates.
Luckily, the recent big update in our system solves all of this and finally makes the following code possible:
// store reference to new arrivals product collection in newArrivals
{loadsubprofile source="productsdatabase:newarrivals" profile=1337 assign=newArrivals}
// loop through the products in newArrivals
{foreach $newArrivals as $arrival}
// find product for male subscribers with an interest in sonic screwdrivers
{if $profile.gender == 'male' && $arrival.type == 'sonicscrewdriver'}
// use the product ID to link to the corresponding product page
<li>{$arrival.productName} <a href="http://somestore.com/products?ID={$arrival.productID}">Order now</a></li>