Overview
Cordial empowers designers to create dynamic, reusable templates and content snippets that enable marketing teams to send highly personalized messages. You can build these assets using either the Sculpt Editor or the HTML Editor.
Sculpt Editor
HTML Editor
Advanced personalization
For advanced personalization, we developed a template syntax based on a custom version of Smarty (a php-based template language). To take full advantage of Cordial's personalization capabilities, you should be proficient with Smarty syntax and know how to code templates that use variables, link functions, conditional logic, and data looping.
How Cordial stores data
Before you dive into Smarty, it's important to know that Cordial stores data in separate collections. Smarty references these collections when rendering data in messages using Smarty variables.
Visit these articles to learn about our data collections:
- Contact collection: stores data specific to contacts, including channels, attributes, list membership, and cart items.
- Event (contact activities) collection: stores event data specific to messages (opens, clicks, etc.) or any custom-named event.
- Product collection: stores data from a product catalog.
- Orders collection: stores order data.
- Supplements collection: stores additional data (store locations, coupon codes, message content, and more) that doesn’t fit into one of the above collections.
In addition to leveraging the above data collections, you can reference external data such as RSS feed, Instagram feed, weather, and data from any other source when personalizing message content.
Personalization with Smarty
Once you understand what data is available to you and how it's stored in Cordial, you can access and render it in messages using Smarty.
Introduction to Smarty
For an introduction to Smarty, go here: Get started with Smarty syntax.
Here are the fundamentals:
- Smarty is wrapped in curly braces.
- CSS also uses curly braces, so be sure to escape CSS using the literal tag, or you'll get errors when trying to save messages.
- Smarty renders when previewing a message or at the time of sending a message.
- You can select a contact's email address when previewing messages to see a live preview of their personalized content.
- Smarty supports variables, conditional statements, data looping, and other functions and modifiers.
Variables
Smarty can access data using variables. Variables can access system data, account data, contact attribute data, and much more. Here are some articles that show what you can do with Smarty variables:
- Variables overview: Get an overview of how variables are used in Cordial.
- System variables: Certain variables are reserved for system values such as email address and message ID.
- Account variables: Account variables are used for account-specific values that can be used for CAN SPAM/CASL compliance in message footers.
- Contact variables: Used to render contact attribute values for each contact such as first name, address, and more.
- Assigning variables: Variables can be set in a message and then recalled throughout. This is useful for link appends or building complex Smarty logic.
- Date and timestamp variables: Used for rendering dates in a message.
- Variable modifiers: Modifiers are used to change the way variables are rendered, such as date formats, numbers, and capitalization.
Link functions
Cordial's custom version of Smarty adds functionality to links beyond simply pointing to a web page. Learn about link functions in the articles below.
- Opt-out link: Modify the default opt-out link using Smarty.
- Add tags to links: Use link tags to associate links in multiple messages for segmentation and reporting.
- Name a tracked link: Give links a more presentable name to use in the UI when viewing reports.
- Link appends: Use Smarty to set up link appends.
- Update list membership: Add or remove contacts to a list when they click a link.
- Update an attribute: Update a contact attribute when a link is clicked.
Conditional statements and data looping
In addition to rendering variables and link functions, Smarty is used for conditional if/then statements for rendering dynamic content. You can also loop through data arrays and render specific values using {foreach}
statements.
Get data arrays
Using Smarty, you can access data arrays from a given collection (such as products), filter the results, and render them in a message. These are called Get data array methods. When you combine these with conditional statements and variables, you pave the way for highly personalized, dynamic content.
The following articles provide explanations and examples of different array methods available:
- Get products: Filter and render products from your product catalog.
- Get events: Filter and render event data such as items browsed on a site.
- Get orders: Filter and render order data in a message.
- Get supplements: Filter and render supplement data in a message.
- Get JSON: Render data from an external source such as an Instagram feed.
HTML content includes
Reusable HTML snippets can be saved in our content library and then rendered in multiple messages using Smarty. Check out the Reusable HTML content overview article to learn more.
Sculpt Editor
The Sculpt Editor provides an easy way to create complex message layouts using a combination of Sculpt Templates and Sculpt Blocks.
You start by creating a Sculpt Template to use as a starting point for messages. From there, you create Sculpt Blocks that can be dragged into Templates during message creation.
Both Sculpt Templates and Blocks support advanced personalization using Smarty.
Sculpt Templates
Before you can use the Sculpt Editor to create messages, a Sculpt Template must be created and saved in your account. A Sculpt Template is the HTML shell that can accept Sculpt Blocks.
Sculpt Blocks
Sculpt Blocks are created separately from Sculpt Templates and live within the Sculpt Block Library. When creating messages, marketers choose a Sculpt Template as a starting point and then drag in Sculpt Blocks to build engaging layouts and customize content.
Designers working in Cordial create a library of Sculpt Blocks that marketing teams can use for messages. Any element within a Sculpt Block (images, colors, fonts, etc.) can be set as editable using variables and then customized.
Helpful resources
These resources can be useful when creating and testing your messages.
- Email boilerplate: The folks at Litmus have put together several responsive email templates to get you started building email code.
- Character converter: If you use special characters in your messages, they may need to be converted to their respective HTML entities. This HTML character converter will do it for you.
- Rendering tests: Both Litmus and Email on Acid provide great tools to test email rendering.
- Smarty documentation: smarty.net/docs/en is the official guide for Smarty. Keep in mind that not all functions and modifiers are supported in Cordial. Check out our full list of supported functions and modifiers here.
- JSON validator: JSONLint is an awesome tool for checking your JSON for errors when making API calls. Sometimes it's something as small as one comma causing the problem.
- HTML, JS, and JSON beautifier: jsbeautifier.org will beautify your code and make it easier to read.
Comments
0 comments
Please sign in to leave a comment.