Dynamic content: how to personalize an email
If you haven't dealt with personalization yet, start small by addressing subscribers by name. Gradually, you'll learn to build logic for more sophisticated personalization, altering entire blocks of email content within a single campaign. For instance, if a user visits a Huawei smartphone page multiple times on an online store, you can send them an email featuring a selection of products from that manufacturer.
In Altcraft Platform, variables are used for personalization. Variables are dynamic content that changes based on the recipient. How does it work? You insert a variable into the message template and launch the campaign. Subscribers receive an email where, instead of the variable, they see relevant content (such as their name, city, a block of products of interest, etc.).
Let's go through a few substitution examples.
As the heading suggests, it's straightforward. You select the variable and add it to the template. The recipient of the email will see their data in place of the variable.
The message template needs to generate a unique greeting and promo code automatically for each customer. To achieve this, add the name variable — {lead._fname} and the promo code variable — {loyalty.welcome.promocode}.
Now, when the campaign is sent, each subscriber will receive an email where they will see their own name and unique promo code.
Below is a list of the primary variables that can be used for straightforward substitution:
Variable | Description | HTML | View |
---|---|---|---|
{lead._fname} | Standard field: "Name" | We're glad you're with us, {lead._fname}! | We're glad you're with us, Carrie! |
{lead.email} | Recipient’s email | The email {lead.email} is linked to your account. | The email janedoe@example.com is linked to your account. |
{resname} | Resource’s name | Thank you for subscribing to our “{resname}” newsletter! | Thank you for subscribing to our “Weekly Digest” newsletter! |
{loyalty.welcome.promocode} | Promo code | Here’s your promo code for your first purchase: {loyalty.welcome.promocode}. | Here’s your promo code for your first purchase: BWYL-1372-ELHF. |
{format datenow "%Y-%m-%D %H:%M:%S"} | Formatted date | Message sent {format datenow "%Y-%m-%D %H:%M:%S"} | Message sent 2022-06-27 12:16:23 |
Sometimes, you might want to send a personalized email, but not all subscribers have a specific variable. In such cases, you can insert a default value instead of the variable. Move to the 'Content' block at the bottom of the page. This block appears only when you use variables. Enter the phrase that users will see in place of the variable.
For instance, if you address the subscriber by name, if the name is known, they'll see 'Hello, dear John!', if not – 'Hello, dear customer!'
The following code is added to the editor:
{if "par1"}
if true
{else}
if false
{end}
Suppose we want to show one product set for male audience, and another one for the female audience.
{if lead._sex equal "Male"}
// Products for the male audience
// ...html...
{end}
{if lead._sex equal "Female"}
// Products for the female audience
// ...html...
{end}
{if lead._sex not_in array["Male" "Female"]}
// Products for the unknown audience
// ...html...
{end}