Home | Dynamic Content | Dynamic Content and Links

Dynamic Content and Links

Dynamic content is one of the most popular ClickDimensions features, and it is easy to see why. Many of our customers see the value of including content in their emails that is pulled directly from each recipient’s lead, contact or account record (or records that the lead, contact or account has an N:1 relationship with). However, there are many other less obvious uses for dynamic content, and some of the questions we get most frequently regarding dynamic content are about how it can be used in conjunction with links.

In this post, I cover the two ways dynamic content can be used with links: using dynamic content to set a link and using dynamic content inside of a link. To illustrate the difference between the two approaches, I show how they can each be used to achieve the same goal of including a customer-specific URL inside of each email sent by a single email send.

Note: If this post looks a little familiar, that’s because there was an older blog post that covered this same topic. Since that post was written, then have been some changes to how ClickDimensions works with FreeMarker within links. This post reflects those changes.

Setting a Link with Dynamic Content

Let’s imagine that each of your customers has a unique URL that takes them to their own personal profile page on your website. Further, each customer’s unique URL is saved to a Profile Link field on their contact record and you want to send an email to all of your customers directing them each to their own profile page.

You can do this easily by following these steps:

1. Ensure that the URL stored in the lead/contact record does not contain the http:// protocol – in order to work, the protocol must be in the template’s HTML rather than in the URL that is to be pulled from the lead/contact field.

2. Use the personalization menu to generate FreeMarker for the contact’s Profile Link field. (Make sure that you have gone to Settings > ClickDimensions Settings and published your Metadata. This publishes your customizations to ClickDimensions so that your custom fields will appear in the personalization menu.) The personalization menu will generate FreeMarker that looks like this (your field’s schema name may vary): ${Recipient.contact.new_profilelink[0]!””}

3. If there is a backup URL that you want to use in the event that the lead/contact receiving the email does not have a value in their Profile Link field, replace the FreeMarker’s double quotes with single quotes, so that !”” becomes !”. Then, place the backup URL between the single quotes, like so: ${Recipient.contact.newprofilelink[0]!’www.backupurl.com’}

As with the URL in the lead/contact field, make sure that the backup URL does not begin with any http:// or https:// protocol.

If you do not have a backup URL that you want to use, remove the !”” from the FreeMarker so that it looks like this: ${Recipient.contact.new_profilelink[0]}

Whether you have a backup URL or not, this step is crucial; if you don’t remove or replace the double quotes, your email will encounter a render error and will not send. This is due to the fact that you will be setting this FreeMarker as a link’s URL and, in HTML, links have this format:

<a href=”www.webpage.com”>Link Text</a>

You can see in this example that the URL will itself be contained within double quotes. You must remove the double quotes from the FreeMarker because, if present, they will prematurely close out the URL in the HTML, thus generating invalid code that gives a render error when sent.

4. Set the modified FreeMarker as the website URL in the link manager by simply opening the link manager as if you were setting a normal link and entering the modified FreeMarker as the website URL.

Dynamic content w links

Here is what your link will look like in the HTML, visible in the ClickDimensions Free Style and Custom HTML email editors: <a href=”http://${Recipient.contact.new_profilelink[0]!’www.backupurl.com’}

Now, when you send out this email, each email will contain a profile link that was pulled directly from the recipient’s contact record.

Dynamic Content Inside of Links

Now that we have covered how to set a link using a full URL pulled from a contact record in CRM, let’s take a look at how to use dynamic content to modify part of a URL with content pulled from CRM. This method requires access to your email’s source HTML, which means that it cannot be done with the ClickDimensions Drag and Drop Editor; you must use the Block, Free Style or Custom HTML editors.

For this example, let’s work toward the same basic goal as in the last example: you want to send an email containing a profile page link that is unique to each recipient. However, in this scenario, we do not have each customer’s full profile page URL saved to a field on their contact record. Instead, we want to construct each customer’s unique profile page URL in the following format: www.mycompany.com/profile/[UniqueCustomerCode]. For this example, we will assume that there is a Customer Code field on each contact record that holds that customer’s unique customer code.

So, what we need to do in this case is pull each customer’s unique customer code into that last portion of the link’s URL. You can do that by following these steps:

1. Create an email template using the ClickDimensions Block, Free Style or Custom HTML email editors.

2. Set the link as you normally would, using the example URL given above: www.mycompany.com/profile/[UniqueCustomerCode]

3. Assign the contents of the contact’s Customer Code field to a variable, using the FreeMarker <#assign> method. Here is how it looks:

<#assign customerCode>${Recipient.contact.new_customercode[0]!””}</#assign>

The code above can be placed in the editor’s design or source view – it does not matter which view because when the email is sent, the FreeMarker will not be included in the actual content. It will be recognized as a FreeMarker method during processing, and thus not included in the rendered email content.

4. Switch to your template’s source view, and modify that link’s URL so that [UniqueCustomerCode] is replaced with FreeMarker that references the variable that was assigned in the previous step. The link will look like this in the HTML:

<a href=www.mycompany.com/profile/${customerCode}>Link Text</a>

Here’s what the assign step and the link HTML look like all together:

<#assign customerCode>${Recipient.contact.new_customercode[0]!””}</#assign>
<a href=www.mycompany.com/profile/${customerCode}>Link Text</a>

Now, when you send this email, each email will contain a profile link that has been modified so that the URL contains the correct information for each recipient.

Happy Marketing!

About the Author:

mm
Weston Packard is the Lead Product Specialist at ClickDimensions.

Leave A Comment