May 21 2013 
Support Center » Knowledgebase » Conditional Content
 Conditional Content
Solution

What is conditional content?

Conditional content allows you to have small variations in your campaign based on the values of custom fields or other conditions at the time of send.

Why is conditional content good for you?

Let's say you have an email campaign that goes out primarily to 4 different states - and you have an advertiser who wants to have the ad in your campaign show for only one of those states. Previously, you would have created 2 campaigns and split your list with a saved search - everyone who doesn't live in NC gets one campaign, NC residents get another - but the rest of the content was the same. So if you found a typo during testing, now you had 2 places it had to be fixed. What a pain.

Enter conditional content! Now, you can have one campaign with 2 different ads, each one for a specific group of people.

How? Let's take a peek.

What is a condition?

A condition is the trigger for a deviation in content. In the previous example, it's the contact's state, stored in a custom field. Almost all conditions are custom fields at the moment, but that will change as we add and expand the conditional content logic. A condition allows you to branch your content - once, twice, or as many branches as you need based on the values you expect in that custom field.

There are two ways you can create conditional content within your email campaigns:

  1. Use our conditional content widget
  2. Manually code conditional content using our specialized tokens

Conditional Content Widget

To use our conditional content widget, create a campaign using either the template editor, regular editor, or copy/paste email types. For this example, we'll use the Template Editor (Template: 1 Column) for our conditional content campaign.

Click on the block where the conditional content will go. Once the editing block pops up, remove the text and click the IF icon (bottom right of your toolbar above the editor) to set your conditional content.

Once you click on this icon, a pop-up window will appear with the different options for conditional content. The first tab is an "IF" tab. IF is your first branch of conditional content - if the value of the custom_field matches the value you specified, this content will be included in that recipient's copy of the campaign - if not, it won't.

The operators are:

  • = (equal to): This condition will trigger if the two values match. It's case-insensitive.
  • != (not equal to): This condition will trigger only if the two values do not match. It's also case-insensitive.
  • < (less than): This condition will trigger if the custom field is less than the value. This only works on numeric values or dates. 2 is less than 3 (2<3), and July 30th is less than August 1st.
  • <= (less than or equal to): This condition will trigger if the custom field is less than or the same as the value. Only for numeric fields or dates.
  • > (greater than): This condition will trigger if the custom field is greater than the value. Also, only numbers or dates.
  • >= (greater than or equal to): This condition triggers if the custom field is greater than or the same as the value. Once again, numbers or dates only.

In this example, we're going to create a condition for those contacts whose State = NC. If a recipients custom field equals "NC" they'll see the sentence: "Here's a sentence for just those contacts whose Custom Field for State = NC" NOTE: You can use html in conditional content widget!

To add more conditions, you can click on the "ELSEIF+" tab. This will present to you a new tab for a new condition. For example, you may have a sentence of text you'd like for those in NY to see. Simply click on the "ELSEIF+" tab, and set up the condition for State = NY.

"ELSE" is used when none of the previous conditions are matched - this is your catchall. In this example, anyone whose state is not NC or NY, they will see the sentence: Here's a sentence for the rest of your contacts.

The "Preview" tab is used so you can see how your conditional content will work for this particular section. You can insert a particular contact's email, or choose a random contact, or you can test the particular condition by inserting the value of the custom field that's associated with a condition. For example, I can put in "NC" under "Custom Field Values" and then hit "Preview" to see the sentence that will be displayed for contacts whose state is NC.

Once you're happy with the conditions, you can click on the "Insert" button at the bottom of this pop-up window. This will bring you back to the Content Editor. You will then click Update Content to view the conditional content in your template.

New Feature! We now have a way for you to truly see your conditional content options. Once you enter your conditional content into the template, you will see numbers in the upper right hand side of the template area. These allow you to toggle between the different conditions and see what each will look like in your template.

Conditional content is not hard to construct, but there are a few things it won't do:

  • You cannot put one IF condition inside of another IF condition - the current version of Conditional Content does not allow "nesting".
  • Composite conditions - you can't yet say IF first_name=Steve OR last_name=Jorbs. This is coming soon!
  • You can only compare against custom fields or MV Split Letter - you cannot yet do: {!IF:EC:Date('d')=1!} for a recurring campaign with different content only on the 1st of the month.

Manually Code Conditional Content

There are 4 main tokens (similar to the RSS tokens) that can be used for conditional content.

IF
{!IF: custom_field=value!}

IF is your first branch - if the value of the custom_field matches the value you specified, this content will be included in that recipient's copy of the campaign - if not, it won't. It's that simple.

ELSEIF
{!ELSEIF: custom_field=value!}

ELSEIF is used for additional branches - it can be on the same custom_field or a different one - but if the IF triggers, no ELSEIF will even get looked at. These are inspected in order.

ELSE
{!ELSE:!}

ELSE is used when none of the previous branches matched - this is your catchall.

END:IF
{!END:IF!}

END:IF closes up the structure, so we know what is conditional content and what isn't. So, in our example:

{!IF: state=NC!}
<img src="nc_ad.jpg"/>
{!ELSE:!}
<img src="normal_ad.jpg"/>
{!END:IF!}

And it's just that easy. Now our contacts with a state of NC get the nc_ad, and everyone else gets the normal_ad. But life isn't generally that straightforward or simple, so let's look at some more convoluted examples.

{!IF: gender=M!}
<p>A special offer for the guys: click here</p>
{!ELSEIF: age>=21!}
<p>Ladies' Night is Thursday!</p>
{!ELSE:!}
<p>Have a great weekend</p>
{!END:IF!}

So males will get one bit of content, and females over 21 will get a different bit of content. We used a comparison operator rather than an equality operator there. We could have said age>20 instead. Now, the else condition covers anyone who hasn't filled in their gender custom field as well as females under the age of 21.

The operators are:

  • = (equal to): This condition will trigger if the two values match. It's case-insensitive.
  • != (not equal to): This condition will trigger only if the two values do not match. It's also case-insensitive.
  • < (less than): This condition will trigger if the custom field is less than the value. This only works on numeric values or dates. 2 is less than 3 (2<3), and July 30th is less than August 1st.
  • <= (less than or equal to): This condition will trigger if the custom field is less than or the same as the value. Only for numeric fields or dates.
  • > (greater than): This condition will trigger if the custom field is greater than the value. Also, only numbers or dates.
  • >= (greater than or equal to): This condition triggers if the custom field is greater than or the same as the value. Once again, numbers or dates only.

Conditional content is not hard to construct - just a couple of special tokens and you're off.

Now, here's some things it won't do:

  • You cannot put one IF condition inside of another IF condition - the current version of Conditional Content does not allow "nesting".
  • Composite conditions - you can't yet say IF first_name=Steve OR last_name=Jorbs. This is coming soon!
  • You can only compare against custom fields or MV Split Letter - you cannot yet do: {!IF:EC:Date('d')=1!} for a recurring campaign with different content only on the 1st of the month.

Conditional Content with Multivariate Splits

I mentioned MV Splits in there - for our API users, instead of providing different HTML and Text content for each split, if you only want to have small changes to your content, you can use the condition SplitPartId or split_letter - either one works, one is just friendlier-looking to API users and the other is friendlier-looking to the Webapp users. MV Splits will be coming soon to the Webapp!

So, example:

{!IF: SplitPartId=A!}
<p>Split A content</p>
{!ELSEIF: SplitPartId=B!}
<p>Humorous split B example</p>
{!END:IF!}

And that's Conditional Content in a nutshell. Enjoy!

français
español



Article Details
Article ID: 1233
Created On: Jun 28 2012 08:46 PM

 This answer was helpful  This answer was not helpful

 Back
HostPapa
 Search
 Article Options
Live chat
Home | Knowledgebase | News | Downloads
Language:

Help Desk Software Help Desk Software By Kayako SupportSuite v3.70.02