Using AMPscript to handle dynamic content for Salesforce Marketing Cloud
Beefree App is now RGE Studio!
The email design suite you already know and love just leveled up. We’re working hard to update our help center, but you still may see some references to the old product name.
Salesforce Marketing Cloud (SFMC) uses a language called AMPscript to display dynamic content, handle conditional statements, and more.
You can insert dynamic content in an email that you are creating in your RGE Studio account and that you will export to and send with SFMC.
Personalization strings as Merge Tags
You can easily personalize your emails with customer information saved in your Salesforce Marketing Cloud account by using personalization strings. View a list of personalization strings that you can use in your emails.
To have them handily available in your RGE Studio account, you can save them as Merge Tags in your Workspace settings.
For example, to save a Merge Tags for the contact's first name, use
%%firstname%%When adding the Merge Tag, it will look something like this:
You can add as many Merge Tags as you like, so that a number of personalization strings are readily available to you in the RGE Studio builder when you are working on emails that will be used in SFMC campaigns.
Conditional statements
You can create conditional statements using AMPscript, and leverage Display Conditions in RGE Studio to add an IF statement to an email directly in the RGE Studio builder.
The syntax of a simple AMPscript IF statement inside an HTML document looks like this:
<!--%%[IF @contactCity !== "Chicago" THEN]%%-->
Some content for Chicago-based contacts.
<!--%%[ENDIF]%%-->To replicate that in the RGE Studio builder, ensure that Display Conditions are active in your Workspace settings. Then, take the following steps:
- Navigate to and enter the email design you'd like to apply the condition for.
- Select the Row containing the content you want to wrap in the conditional statement.
- In the sidebar under the Rows tab, navigate to Dynamic Content.
- Click on Add Condition.
- Enter your AMPscript code in the Before and After fields.
- Click Save to save the conditional statement.
Note: In this screenshot the closing --> was replaced with a right-pointing arrow. You can ignore that. The correct --> was saved to the code.
Other notes
Reference the following considerations and additional resources for more information on using AMPscript with Salesforce Marketing Cloud.
- For an introduction to AMPscript, please see the AMPRscript for Marketing Cloud Engagement Getting Started Guide.
- AMPscript keywords and function names are case-insensitive.
- AMPscript supports conditional logic. Reference the Evaluating Conditions Guide for a list of Operators.
- For more details about using RGE Studio with SFMC, visit Exporting to Salesforce Marketing Cloud.
Comments
0 comments
Please sign in to leave a comment.