Conditions
Allows to display various parts of message depending on campaign or contact or message_info, contact custom fields or tags, contact geo location or dates.
md
{{IF `(pet IS_DEFINED)`}}
{{IF `(pet STRING_EQ 'dog')`}}
Buy a bone for your dog! {{LINK `http://mysite.com/shop/product/bone_for_dog`}}
{{ELSIF `(pet STRING_EQ 'cat')`}}
Buy a mouse toy for your cat! {{LINK `http://mysite.com/shop/product/toy_mouse_for_cat`}}
{{ELSE}}
You may find something for your pet in my store!
{{ENDIF}}
{{ELSE}}
You don't have a pet yet. Buy one!
{{ENDIF}}
{{IF `((city STRING_EQI 'Gdańsk') LOGIC_OR ((city STRING_EQI 'Gdynia') LOGIC_OR (city STRING_EQI 'Sopot')))`}}
You can visit our store located in 3City in person!
{{ELSE}}
Go to our online page: {{LINK `http://mysite.com/shop`}}
{{ENDIF}}
{{IF `(day_name STRING_NEQ 'Sunday')`}}
We're open today.
{{ELSE}}
Please visit us from Monday to Saturday
{{ENDIF}}Order of tags:
{{IF `...`}}– Mandatory beginning of conditional statement.{{ELSIF `...`}}– Optional block, multiple allowed.{{ELSE}}– Optional default block, one allowed.{{ENDIF}}– Mandatory closing of conditional statement.
Building conditions step by step:
Take left operand, this can be name of contact custom field or tag or token from campaign or contact or message_info, contact geo location, dates.
mdDAYLowercase this operand.
mddayTake right operand which is constant value you like left operand to be compared against.
md8Quote this operand in single quotes, this is mandatory even if operand is numeric.
md'8'Join operands with operator.
mdday NUMBER_GT '8'Wrap this pair in round brackets to get conditional statement.
md(day NUMBER_GT '8')(optional) If you need more complex logic you can join conditional statements with logic operator. Remember about top round brackets to create conditional statement.
md((day NUMBER_GT '8') LOGIC_AND (day NUMBER_LT '16'))Use conditional statement in tag param.
md
{{IF `((day NUMBER_GT '8') LOGIC_AND (day NUMBER_LT '16'))`}}
You will see this if message was sent between 8th and 16th day of month.
{{ENDIF}}Operators:
NUMBER_LT– Less than.NUMBER_GT– Greater than.NUMBER_EQ– Equal.NUMBER_NEQ– Not equal.NUMBER_GEQ– Greater or equal.NUMBER_LEQ– Less or equal.NUMBER_DIV- True if divisable by given value.STRING_EQ– Equal.STRING_EQI– Equal but case-insensitive.STRING_NEQ– Not equal.STRING_NEQI– Not equal case-insensitive.DATE_IS_ANNIVERSARY- True during anniversary of operand (check notes below for details). Only left operand is required -(subscriber_created_at DATE_IS_ANNIVERSARY).DATE_IS_MENSIVERSARY- True during mensiversary of operand. Only left operand is required -(revewal_started_at DATE_IS_MENSIVERSARY).LOGIC_OR– Union used if A and B are conditions.LOGIC_AND– Intersection used if A and B are conditions.IS_DEFINED– Check for value presence. Only left operand is required -(car IS_DEFINED).NOT_DEFINED– Check for value absence. Only left operand is required -(car NOT_DEFINED).
WARNING
If you use (pet STRING_EQ 'dog') and contact custom field pet is not defined then the statement will evaluate to false. In most cases this is what you mean, but it is better to use additional IS_DEFINED operator to keep logic clean.
WARNING
If you apply NUMBER_* operator to not numeric value it will evaluate to false.
WARNING
If custom field in condition is multi value then conditional statement will evaluate to true if any element matches it. So if custom pet has values "mouse" and "hamster" then (pet STRING_EQ 'mouse') is true because "mouse" value meets the condition, but also (pet STRING_NEQ 'mouse') is true because "hamster" value meets the condition.
Mangling
Mangling allows you to use contact custom field name or tag name or token name as left operand without having to worry about its tag type. For example if you use (city STRING_EQI 'Gdańsk') then:
- Value of contact custom field city is checked. If it exists conditional statement is resolved to true or false at this stage.
- City is also token in contact geo location. If it exists and conditional statement is not yet resolved then conditional statement is resolved to true or false at this stage.
- Conditional statement is false if not yet resolved.
Presence of custom/tags of given name is always checked before presence of such named token in other tags. Do not nest whole tags, for example {{IF `{{CUSTOM `pet`}} STRING_EQ 'dog'`}} is not correct syntax.
Anniversary/mensiversary notes
- Month length differences: If day in operand does not exist in current month anniversary / mensiversary happens on last day of current month. For example someone who subscribed on
2026-01-31has mensiversary on2026-04-30(April does not have 31 days). Someone who subscribed on2024-02-29(leap year) has anniversary / mensiversary on2026-02-28(February in non-leap year does not have 29 days). - Time zones: GeoIP time zone is used if known. Otherwise user timezone set in GetResponse account is used. For example someone from Poland who subscribed at
2024-01-21 10:00:00 UTCwith known GeoIP ofEurope/Warsaw(so subscription time from his perspective is2024-01-21 11:00:00 Europe/Warsaw) has example mensiversary on2024-02-21 Europe/Warsaw(2024-01-20 23:00:00-2024-01-21 23:00:00UTC). So feature respects calendar day boundaries from recipient perspective. Warning: Custom field values do not carry time zone information and are assumed to be in UTC for this conversion. Do not store custom field values recalculated to your local time or double conversion will happen.
