The new personalization engine (introduced in v5.0.0 RC2)

This feature is available starting from Oempro v5.0.0 RC2.

Starting from Oempro v5.0.0 RC2 release, we have introduced a brand new personalization engine and email content tags. We will remain our legacy personalization engine until Oempro v6 version release.

This new personalization engine introduces new syntax. From now on, instead of %...% syntax, the brand new {{ ... }} syntax will be used.

Here’s an example:

{{ Subscriber:EmailAddress }} will be replaced with the email address of the recipient.

In addition to standard personalization, our new personalization engine includes powerful conditional personalization.

Whitespace

Whitespace before or after the delimeters is allowed, however, in certain cases, whitespace within the tag is prohibited (explained in the following sections).

Some valid examples:

{{ name }}
{{name }}
{{ name}}
{{  name  }}
{{
  name
}}

Some invalid examples:

{{ na me }}
{ {name} }

Comments

You can add comments to your templates by wrapping the text in {{# #}}.

Example

{{# This will not be parsed or shown in the resulting HTML #}}

{{#
    They can be multi-line too.
#}}

Prevent Parsing

You can prevent the parser from parsing blocks of code by wrapping it in {{ noparse }}{{ /noparse }} tags.

Example

{{ noparse }}
    Hello, {{ name }}!
{{ /noparse }}

Basic Example:

{{# Parsed: Hello, World! #}}
Hello, {{ name }}!

{{# Parsed: <h1>Oempro is Awesome!</h1> #}}
<h1>{{ title }}</h1>

{{# Parsed: My real name is Oempro User!</h1> #}}
My real name is {{ Subscriber:FirstName }} {{ Subscriber:LastName }}

Conditionals

Conditionals in Oempro are simple and easy to use. It allows for the standard if, elseif, and else but it also adds unless and elseunless.

The unless and elseunless are the EXACT same as using {{ if ! (expression) }} and {{ elseif ! (expression) }} respectively. They are added as a nicer, more understandable syntax.

All if blocks must be closed with the {{ endif }} tag.

Variables inside of if Conditionals, do not, and should not, use the Tag delimeters (it will cause wierd issues with your output).

A Conditional can contain any Comparison Operators (==, !=, ===, !==, >, <, <=, >=). You can also use any of the Logical Operators (!, not, ||, &&, and, or).

Examples

{{ if Subscriber:FirstName }}
    <p>My name is {{ Subscriber:FirstName }} {{ Subscriber:LastName }}</p>
{{ else }}
    <p>I don't know what my name is</p>
{{ endif }}

{{ if Subscriber:CustomField18 == 'customer' }}
    <p>You are a Customer!</p>
{{ elseif Subscriber:CustomField18 == 'trial' }}
    <p>You are a trial User.</p>
{{ else }}
    <p>I don't know what you are.</p>
{{ endif }}

{{ unless age > 21 }}
    <p>You are too young.</p>
{{ elseunless age < 80 }}
    <p>You are to old...it'll kill ya!</p>
{{ else }}
    <p>Go ahead and drink!</p>
{{ endif }}

The not Operator

The not operator is equivilent to using the ! operator. They are completely interchangable (in-fact not is translated to ! prior to compilation).

Undefined Variables in Conditionals

Undefined variables in conditionals are evaluated to null. This means you can do things like {{ if foo }} and not have to worry if the variable is defined or not.

Checking if a Variable Exists

To check if a variable exists in a conditional, you use the exists keyword.

Examples

{{ if exists Subscriber:CustomField100 }}
    Foo Exists
{{ elseif not exists Subscriber:CustomField100 }}
    Foo Does Not Exist
{{ endif }}

You can also combine it with other conditions:

{{ if exists Subscriber:CustomField100 and Subscriber:CustomField100 !== 'test' }}
    Something here
{{ endif }}

The expression exists foo evaluates to either true or false. Therefore something like this works as well:

{{ if exists Subscriber:CustomField100 == false }}
{{ endif }}

JSON Custom Fields

If the subscriber custom field value is a JSON data, the personalization engine can detect this and you can personalize your email content with any values inside the custom field.

For example, if the custom field value is:

{"key1":"val1","key2":"val2","key3":"val3"}

You can personalize your email content with any of these values:

{{ Subscriber:CustomFieldXXX:key2 }}

XXX represents the target custom field ID.