Conditional Formatting
Adobe Campaign allows the use of conditional formatting to display different content in the same template. This formatting can be used anywhere in the body of an email and in the subject line field.
The best example of this is in our footers, where Spanish is shown to subscribers of el Nuevo Herald and English is shown for everywhere else.
Syntax
This code looks like JavaScript except that every portion of JS has to be contained within the <% %>
tag that Adobe Campaign uses. This can be used on the simplest level just using an if
statement followed by a single else
statement, or can go as specific as needed with multiple else if
statements in between. Usually siteName
is the parameter we use to determine conditional formatting.
<% if (siteName == 'site1') { %>
site1 stuff
<% } else if (siteName == 'site2') { %>
site2 stuff
<% } else { %>
all other sites stuff
<% } %>
==
for "is equal to" and !=
for "does not equal."
Sometimes an OR statement might be needed. Set those up like this:
<% if (recipient.siteName == 'site1' || recipient.siteName == 'site2') { %>
site1 and site2 stuff
<% } else { %>
all other sites stuff
<% } %>