Overview
Dynamic Content is composed of two elements: Global snippets (formerly called Shared Content) and template-level, or local, snippets.
Global snippets are reusable templating elements that can easily be used in all Templates. Common examples of global snippets include Email Headers and Footers, Social Media icons, and legal disclaimers. Once global snippets are present in Templates, any changes to the configuration of the global snippet will cause all instances of the global snippet to update. This content is considered global.
Template-level snippets are not available to all templates like global snippets are. Instead, template-level snippets are configured for each Template individually. While snippets are meant to be used within a single template, global snippets are created with multiple templates in mind and can be used in any number of different templates. Snippets are commonly used to handle data management or advanced properties in a separate location than an HTML Template. Instead of coding everything within one file, a Snippet allows the organization of data and is referenced in the final product. This content is considered local.
Both global snippets and local snippets are written in HTML and FreeMarker. Knowledge of these languages is necessary to use Dynamic Content effectively. Find more information on FreeMarker here.
Table of Contents
Common Examples of Dynamic Content
Global snippets
Creating global snippets
Navigate to Content > Global snippets to access the Dynamic Content feature. In doing this, global snippets are saved in a file format. You will then need to select the appropriate folder and use the Create global snippets button to add a new global snippet. After a global snippet is created, it will be available to reference in any template within your organization.
Give the global snippet a name and description and save the first version of the content.
Similar to when you use local snippets, the global snippet library is a repository of macros, functions, HTML, and other coded content for use within templates. Because global snippets are managed as an asset, each instance of it can be organized into folders and have differing Permissions applied.
The code for including global snippets in a template looks like this:<#include '/global/yourglobalsnippetname’>
HTML and FreeMarker
All Dynamic Content, whether it’s global snippets or local snippets, is written in HTML. FreeMarker, a third-party template engine, is supported in Accelerator.
Global snippets can be created in the available text editor or imported from a local file.
The benefit of using global snippets is the ability to easily reuse items that are present on multiple Templates.
Type or paste the HTML into the Dynamic Content editor and use the Action drop-down to save.
Testing global snippets
When ready to implement a global snippet, it is a best practice to test the content before exiting. If the global snippet has not been tested, a warning will display.
Changes to global snippets will also change any Template that currently uses the global snippet. It will also remind the user that this global snippet will be available to select for all Templates.
Using the Test feature, the global snippet will automatically detect if there are any issues in variable names, data types, or naming conventions. If there are issues, the testing interface will display up to 100 of the detected errors with a description of the issue.
Once saved, the global snippet is available for use in Templates.
Snippets
Snippets are Dynamic Content, but are not considered global like global snippets. Instead, Snippets are considered local. Snippets are configured and used within one Template. Open a Template to the Template Overview screen to add a new Snippet.
The method of creating a Snippet is the same as creating a global snippet. Clicking the + Snippet button opens the Snippet view. The Snippet view displays any created Snippets. Use the Action button in the top right to add a new Snippet.
The Snippet editor works in the same manner as the global snippet editor. HTML and FreeMarker are supported.
Snippets are commonly used for data manipulation purposes. For example, if the data coming in from an Audience must be processed and modified for a later API call, Snippets are useful for centralizing all the data manipulation processes under one name. This is one of many uses for Snippets.
Snippets can be created using one of two views. The default view when editing or creating a Snippet is the Source View. Switching to the WYSIWYG Editor allows for easier formatting. WYSIWYG stands for What You See Is What You Get. This is the preferred formatting for those without knowledge of HTML.
If using Snippets for the FreeMarker features, the Source view must be used.
Snippets also support importing a file instead of creating the HTML in the editor.
Use the Theme drop-down to change the style of the text editor. It is set to Default automatically, but there are dozens of additional options.
Once configured, use the Test button to check the Snippet against the Template.
Save the Snippet to be able to place it in a Template.
Use the Back to Snippet List to exit the Snippet Editor.
Adding Dynamic Content
Templates can be added through the Drag-and-Drop Editor or the HTML Editor.
Adding Dynamic Content with the Drag-and-Drop Editor
Dynamic Content is an option under the Content tab. Click and drag the Dynamic Content to the appropriate location.
With the Dynamic Content item selected on the Template, select the global snippet or local snippet desired from the Content Properties. All local snippets are named "local/Snippet_Title". Global snippets are named "global/Content_Title".
It is important to Preview the Template when using Dynamic Content to ensure the message is rendering properly. This is also why it is important to test Dynamic Content prior to use.
Adding Dynamic Content with the HTML
While the Drag-and-Drop Editor is a valuable tool, knowledge of HTML, CSS, and FreeMarker leads to more customization. Adding Dynamic Content through the Source View is simple.
Using FreeMarker, adding Dynamic Content is one line of code.
For local snippets: <#include 'local/Snippet_Title'>
For global snippets: <#include 'global/Shared_Content_Title'>
Common Examples of Dynamic Content
Global snippet in HTML Template
Variable Assignment with Snippets
Local snippet content in HTML Template
Email Footer
Static items, pieces of content that don’t change from one email to another, are easily handled using global snippets. This could be a visual header to an email with a company logo and a hyperlink or an email footer with legal disclaimers and an unsubscribe link. Anything that will be constant in all Templates can be implemented with global snippets.
Below is a basic example of an Email Footer described in a global snippet and added to an HTML Template.
Global snippet code
<!--footer section-->
<tr>
<td valign="top" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#69d2e7">
<tr>
<td width="50" class="em_side"> </td>
<td valign="top" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="60" class="em_height"> </td>
</tr>
<tr>
<td valign="top" align="center"><table width="200" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top" width="32"><a href="#" target="_blank" style="text-decoration:none;"><img src="https://s3.amazonaws.com/mg-demo-assets/1490713870953_Welcome/images/fb.png" alt="FB" height="32" border="0" width="32" style="border:none; display:block; font-family:Arial, sans-serif; font-size:16px; line-height:18px; color:#000000; text-align:center;" /></a></td>
<td width="10"> </td>
<td valign="top" width="32"><a href="#" target="_blank" style="text-decoration:none;"><img src="https://s3.amazonaws.com/mg-demo-assets/1490713870953_Welcome/images/tw.png" alt="TW" height="32" border="0" width="32" style="border:none; display:block; font-family:Arial, sans-serif; font-size:16px; line-height:18px; color:#000000; text-align:center;" /></a></td>
<td width="10"> </td>
<td valign="top" width="32"><a href="#" target="_blank" style="text-decoration:none;"><img src="https://s3.amazonaws.com/mg-demo-assets/1490713870953_Welcome/images/insta.png" alt="INSTA" height="32" border="0" width="32" style="border:none; display:block; font-family:Arial, sans-serif; font-size:16px; line-height:18px; color:#000000; text-align:center;" /></a></td>
<td width="10"> </td>
<td valign="top" width="32"><a href="#" target="_blank" style="text-decoration:none;"><img src="https://s3.amazonaws.com/mg-demo-assets/1490713870953_Welcome/images/yt.png" alt="YT" height="32" border="0" width="32" style="border:none; display:block; font-family:Arial, sans-serif; font-size:16px; line-height:18px; color:#000000; text-align:center;" /></a></td>
<td width="10"> </td>
<td valign="top" width="32"><a href="#" target="_blank" style="text-decoration:none;"><img src="https://s3.amazonaws.com/mg-demo-assets/1490713870953_Welcome/images/pin.png" alt="PIN" height="32" border="0" width="32" style="border:none; display:block; font-family:Arial, sans-serif; font-size:16px; line-height:18px; color:#000000; text-align:center;" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="20" style="line-height:1px;font-size:1px;"> </td>
</tr>
<tr>
<td valign="top" align="center" style="font-family:Arial, sans-serif; font-size:13px; line-height:20px; color:#ffffff;"><strong>Call:</strong> <a>+0 123 456 789</a> | <span>Email:</span> <a>contact@getawayhotels.com</a></td>
</tr>
<tr>
<td height="10" style="line-height:1px;font-size:1px;"> </td>
</tr>
<tr>
<td valign="top" align="center" style="font-family:Arial, sans-serif; font-size:13px; line-height:20px; color:#ffffff;"><span style="font-weight:bold;">Address:</span> 191 Peachtree St NE, Atlanta, GA, USA.</td>
</tr>
<tr>
<td height="56" class="em_height"> </td>
</tr>
</table></td>
<td width="50" class="em_side"> </td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top" align="center" class="em_aside"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="20" style="line-height:1px;font-size:1px;"> </td>
</tr>
<tr>
<td valign="top" align="center" style="font-family:Arial, sans-serif; font-size:12px; line-height:20px; color:#999999;">© 2017. All Rights Reserved. | <span style="text-decoration:underline; color:#999999;"><a href="#" target="_blank" style="text-decoration:underline; color:#999999; white-space:nowrap;">View Online</a></span> | <span style="text-decoration:underline; color:#999999;"><a href="#" target="_blank" style="text-decoration:underline; color:#999999;">Unsubscribe</a></span></td>
</tr>
<tr>
<td height="20" style="line-height:1px;font-size:1px;"> </td>
</tr>
</table></td>
</tr>
<!--//footer section-->
Global snippet in Template
< div style="padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;"><#include 'global/CWL Company Footer'></div>
Content Output
Email Header
Global snippet code
<div align="center" class="img-container center autowidth " style="padding-right: 0px; padding-left: 0px;">
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px;line-height:0px;"><td style="padding-right: 0px; padding-left: 0px;" align="center"><![endif]-->
<img class="center autowidth " align="center" border="0" src="https://mg-cf.s3.amazonaws.com/img/77D2A95D1ABD2AA8C3A3790EF87B601AD9BAA3D3/City%20%26%20Glory/Welcome-email_03.jpg" alt="Image" title="Image" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: 0;height: auto;float: none;width: 100%;max-width: 343px" width="343" />
<!--[if mso]></td></tr></table><![endif]-->
</div>
Global snippet in HTML Template
<div style="padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;"><#include 'global/Training/CWL City & Glory Header'></div>
Content Output
Variable Assignment with Snippets
Not all items of Dynamic Content are visible. Snippets are a great way to centralize all Variable Assignments under one easy-to-manage set of instructions. Instead of coding this directly into a Template, the code is placed in a Snippet and easily referenced within an HTML Template or the Drag-and-Drop Template Editor.
Snippet Content Code
<#assign cust_token = ${Recipient.cust_code} + "-" + ${Gears.recipientId()} + ${Gears.date}>
<#assign cust_name = ${Recipient.preferred_name + " " + ${Recipient.last_name}>
Snippet Content in HTML Template
<#include 'local/Variables'>
Comments
Please sign in to leave a comment.