In email, engagement is key. And we’re always testing new ways to capture an audience’s attention to get them to open an email and click through to the content we provide for our clients.

2020 Tableau Conference-ish Recap: Simplifying Analytics Visualizations

But did you know that personalizing your email subject lines can increase the likelihood of your subscribers opening the message? According to Campaign Monitor, that increase could be as high as 26%.

One of the ways we incorporate this in Salesforce Marketing Cloud is through personalization strings like %%FirstName%% when the first-name field appears in a sending list or sending data extension. However, we prefer to use AMPscript, Marketing Cloud’s proprietary scripting language, to provide a better experience when formatting subscriber data and personalizing emails.

Let’s dive into why.

What is AMPscript?

AMPscript allows you to personalize emails—both HTML and text—landing pages, SMS messages, and push notifications using the Salesforce Marketing Cloud platform.

What makes AMPscript a better experience lies in how it works. Marketing Cloud processes the script—such as a name, location, or anything included in your data extensions—at the point in your message where it’s located, meaning the content is rendered on a subscriber-by-subscriber basis. This process is completed at the end of the email send within Marketing Cloud.

The basic components of AMPscript

To understand how AMPscript works, we first need to see what it looks like. In this example, we’ll imagine we’re using a data extension or list that includes a first-name field.

%%[

var @FirstName

set @FirstName = [field name in data extension or list]

]%%

  • Open and closing statements: AMPscript always opens and closes with %%[ and ]%%, respectively.
  • Declaring your variable(s): Next, use “var” to declare the variables you intend to use. You can have as many variables as you’d like, but we’ll just keep one for this example.
  • Setting your variable(s): Next, you’ll set your variable by telling the AMPscript what information to bring in for the variable you declared above.

To pull in the first-name variable, you would open and close it with %%= and =%%, like this:

%%=v(@FirstName)=%%

In this example, the “v” indicates the function, and tells the code to output the variable.

If you’re personalizing a subject line, you may input this:

%%[var @FirstName set @FirstName = [field name in data extension or list]]%% %%=v(@FirstName)=%%, check out this offer

Now, let’s dive into two ways you can used AMPscript to increase personalization in your email subject lines.

Using the AMPscript ProperCase function

Learn how DEG helped The Salvation Army personalize its Giving Tuesday campaign

Depending on how clean your subscriber data is, you may need to adjust the capitalization case of the names in your list or data extension. You may have some names listed in uppercase, lowercase, or a combination of the two, which can be attributed to how it was entered by the subscriber or captured in your email preference center.

To fix this, we can use the ProperCase AMPscript function to clean up the presentation of this data.

Consider if we had the name “Kelly” listed in all caps as “KELLY” or all lowercase “kelly.” Using the ProperCase function, we can ensure it shows up as “Kelly” in our email messages by inputting this:

%%[var @FirstName set @FirstName = [field name in data extension or list]]%%

%%=Propercase(@FirstName)=%%, check out this offer

Instead of using the “v” function, we use the “ProperCase” function to call up the first-name variable and ensure capitalization is correct. If you’d rather make your names all uppercase or all lowercase to match your brand voice or subject-line intention, you can use other AMPscript formatting functions.

Using the Empty function in AMPscript

Now, consider if you have subscribers without a first name listed in your send list or data extension. For this challenge, you can implement the Empty function to send your message with a personalized subject line for subscribers who have first-name data and a generic subject line for subscribers who do not. To do this, we also leverage the not operator within our AMPscript code.

%%[var @FirstName set @FirstName = [field name in data extension or list]]%%

%%[If Not Empty(@FirstName) Then]%%

%%=Propercase(@FirstName)=%%, check out this offer

%%[Else]%%

Check out this offer

%%[EndIf]%%

Not only can this code help you personalize your email subject lines, but it can also be used in other sections of your email message as well.

Check out this example email sent by Hallmark, which used the Empty function and not operator to personalize the body text for some subscribers and provide a generic message for others.

Generic Hallmark email message talking to anyone without a name in the database about new personalized book optionsHallmark email message talking to Karen about new personalized book options

 

Before you send your email with AMPscript

When coding AMPscript in Salesforce Marketing Cloud, always use the Preview and Test functionality to review and ensure your email looks good. This allows you to check your sending audience view to see if the scripting includes any errors so you can fix them before deploying your message. You can also view the output for a given subscriber record.

Do you have any other tips when using AMPscript in your emails? Let us know in the comments below.

Continue learning on Salesforce Trailhead

Salesforce’s Trailhead resource allows you to skill up on AMPscript and other Marketing Cloud, Commerce Cloud, Sales Cloud, Service Cloud, and Experience Cloud tools. Two lessons I recommend are:

You can also check out The AMPscript Guide, an online resource for the book of the same title, which was co-written by DEG Salesforce Marketing Cloud Engineering Team Lead and Salesforce MVP Adam Spriggs.

Partnering with one of the largest Marketing Cloud teams

Optimizing Data in Salesforce Marketing Cloud

DEG is a Platinum Salesforce Consulting Partner with one of the largest Marketing Cloud teams outside of Salesforce. As an agency partner, we help national and global brands—including Gap Inc., PepsiCo, AMC Theatres, and Party City—craft personalized content to connect with customers across all digital channels.

We also have a full-service email campaign management team that deploys billions of email campaigns throughout the year, reaching customers in the moments of greatest impact. We can help you do the same—as a partner who handles as much, or as little, of email builds, tests, and sends as you need.

Let’s talk about how we can work together to develop an engaging email marketing program for your brand.

Keep in touch.

Stay up-to-date on the latest digital trends, DEG news, and upcoming events by subscribing to DEG's newsletter.

Subscribe

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comments