Partners Support Log In
Frank Hagan


    Back to Top

    Formatting Merge Fields


    Applies to: All ONTRAPORT accounts.

    ONTRAPORT has an extensive selection of merge fields to customize your email, forms and landing pages. Merge fields can insert the customer's name, credit card expiration date, or last purchase amount into your content. Merge fields are available from a drop down selection in Messages, Forms, Landing Pages, and Tasks.

    merge fields

    Note: Do not copy merge fields from another email template or document type such as Word or Google Docs. Use the drop down Merge Field selector only to insert merge fields. If you do copy from another document or email delete the merge fields and replace them using the drop down selector. "Hidden" HTML or editor formatting codes will break the merge field and cause it to be sent as "plain text" in your email.

    Most merge fields will come pre-formatted but Date and Text merge fields have additional formatting options.

    Formatting Date Merge Fields

    Date fields in the Contact record can be formatted in four different styles with two additional European formats:

    Long Date: January 21st, 2015
    Short Date: Jan 21, 2015

    Standard Slash: 1/21/2015
    Standard Dash: 1-21-2015

    European Slash: 21/1/2015
    European Dash: 21-1-2015

    Contact field dates, including custom date fields you add, have a pop up date formatter. You can add a date offset in days to the date so that the date displayed is X number of days later or sooner.

    date formatter


    Some calculated date fields may not provide the date formatter. You can add formatting to the merge field. An example of a calculated date field that does not provide the date formatter is the [nDate] field ... the send date of the current message. The following examples show how to format it:

    Long Date: [nDate long+0] (formats as January 21st, 2015)
    Short Date: [nDate abb+0] (formats as Jan 21, 2015)

    Standard Slash: [nDate ss+0] (formats as 1/21/2015)
    Standard Dash: [nDate sd+0] (formats as 1-21-2015)

    European Slash: [nDate es+0] (formats as 21/1/2015)
    European Dash: [nDate ed+0] (formats as 21-1-2015)

    The "+0" adds zero days to the date, showing the actual send date of the email. To show a date two days later replace "+0" in the examples with "+2".

    The day of the week can also be revealed using "dayname+0" for the actual day of the week, and "dayname+2" for two days later.

    Merge fields can be used to create a sentences such as "Next Wednesday, Jan 28, 2015, we will be giving you a call". If the email is sent on Wednesday, Jan 21, the merge fields used in the sentence would be: "Next [nDate dayname+7], [nDate abbr+7], we will be giving you a call."

    Formatting Text Merge Fields

    Text fields, such as the First Name and Last Name field, retain the original formatting when imported or input. Many contacts will fill out your opt in forms using all caps, all lowercase, or other alternate capitalization. ONTRAPORT provides the following text merge field formatting options using the [Address] merge field as an example:

    [Address ##cap] - Capitalize first letter of each word. Ignore all other letters.
    "2040 alameda padre SERRA" becomes "2040 Alameda Padre SERRA"

    [Address ##cap_lower] - Capitalize first letter in each word and force all others to lower case
    "2040 alameda padre SERRA" becomes "2040 Alameda Padre Serra"

    [Address ##cap_first] - Capitalize the first letter in the first word only, and ignore all the other letters.
    "2040 alameda padre SERRA" becomes "2040 Alameda padre SERRA"

    [Address ##cap_lower_first] - Capitalize the first letter of the first word and force the rest of the letters in the first word to lower case. Ignore all other letters.
    "2040 alameda padre SERRA" becomes "2040 Alameda padre SERRA"

    Default Merge Fields

    ONTRAPORT allows virtually all Contact Record fields to be used as merge fields. This allows you to personalize an email to include a salutation such as "Dear [First Name] [Last Name]," But what if a Contact does not have a First and Last name in the Contact Record? "Dear ," does not look very professional.

    You can set the default value for any field in Contacts > Settings > Default Merge Fields. These values are only used when a merge field is used to generate content in an email, landing page, or task, and the field for that Contact is empty. They do not change any of your Contact Record data. Adding "Valued" for the First Name field, and then "Customer" for the Last Name field would allow the email salutation to read "Dear Valued Customer," - a much better result than "Dear ,".

    It is a best practice to consider how you format your content. If you are on a first name basis with your Contacts, and don't use their last name in any content, choose a word like "Friend" for the First Name field.

    Articles in this section

    Created - Updated
    Have more questions? Submit a request


    • Avatar
      Christian E.

      A Default Merge field is already something, but is not very usefull thou.
      If you need to capitalize, or to change the way you write. For example:
      John, thank you so much for comming.
      Buddy, thank you so much for comming. (ok so far)
      Dear John, thank you for your purchase
      Dear Buddy (?!?!) thank you for your purchase. (not ok at all)

      And sometimes is better replace with nothing (empty):
      Hey John, thanks for the visit!
      Thanks for the visit! (in this case, we do not want Hey and neither the comma)


      The best way would be to be able to set default value on the go (while writing e-mail).
      Its really easy with all this liquid tags from our days.
      for example:
      Dear {{first_name | default:"customer"}}, thank you for your purchase.
      {% if first_name %}}Hey {first_name}, thanks {% else %}Thanks {% endif %}for the visit! (just a more complex example, but it's really versatile.

      Is possible to do something like this on e-mails, or in this case is needed to create different sequence conditions (if name exists) and deliver different messages?


    • Avatar
      Nathaniel Pulsifer (DCF)

      this does to appear to work-
      Hi there, [First Name]:
      Date: [nDate dayname], [nDate abbr]

      results in the name being filled, but not the other fields. in my emails, they just come thru as [nDate dayname], [nDate abbr] brackets included

    • Avatar
      Frank Hagan

      The date formatting is not quite correct in your example. Use [nDate dayname+0] and [nDate abb+0] and it will work.

    • Avatar
      Nathaniel Pulsifer (DCF)

      works- thanks!
      A suggestion- you need to put this into the dropdown on the message editor as an available merge field. it's not there.

      Also, you need a central place where users can find this sort of 'secret' stuff - as a OAP user for 5+ years I'm constantly finding things that are not self evident or documented. A large table of ALL the available merge fields would be super helpful...