Understanding Merge Tag Structure and Formatting

Merge tags in DonorDock follow a specific structure so the system can identify what information to retrieve and, in some cases, how that information should appear in the finished communication.

Understanding the basic parts of a merge tag helps when reviewing templates, troubleshooting a tag that isn't populating, or determining why a value such as a date or dollar amount appears in a particular format.

Merge Tags Must Include Double Braces

A complete merge tag is always enclosed in two opening braces and two closing braces.

For example:

{{donor.first_name}}

The braces are required. DonorDock uses the complete double-brace structure to recognize the text as a merge tag rather than ordinary template content.

For example:

{{donor.first_name}} ✅

{donor.first_name} ❌

{{donor.first_name} ❌

donor.first_name ❌

The text inside the braces must also remain intact. When inserting or copying a merge tag, use the complete tag provided by DonorDock rather than manually changing the field name or syntax.

Understanding the Parts of a Merge Tag

A basic merge tag may contain only the field DonorDock should retrieve.

For example:

{{donor.first_name}}

In this tag:

  • {{ begins the merge tag.

  • donor identifies the type of record the information comes from.

  • first_name identifies the specific field to populate.

  • }} closes the merge tag.

When DonorDock generates the communication, it replaces the complete merge tag with the corresponding value.

Formatting Instructions

Some merge tags also include instructions that tell DonorDock how to display the underlying value. These instructions appear inside the braces after a vertical bar (|).

For example:

{{gift.received_amount | currency}}

In this merge tag:

  • {{ begins the merge tag.

  • gift.received_amount identifies the DonorDock field.

  • | currency tells DonorDock how to format the value.

  • }} closes the merge tag.

The complete structure must remain intact for the tag to work correctly.

Currency Formatting

Merge tags containing:

| currency

format the underlying numeric value as currency.

For example:

{{gift.received_amount | currency}}

may take an underlying value such as:

1500

and display it as:

$1,500.00

Currency formatting adds the currency symbol, thousands separators, and decimal places so monetary values are easier to read in receipts, acknowledgments, pledge reminders, and other donor communications.

Underlying Value

Generated Value

50

$50.00

1500

$1,500.00

12500.5

$12,500.50

Currency formatting may be used with Gift amounts, fees, net amounts, deductible amounts, Soft Credit totals, Pledge balances, and other monetary values.

Date Formatting

Date merge tags may include formatting instructions such as:

| date:"MMMM dd, yyyy"

For example:

{{donor.last_gift_date | date:"MMMM dd, yyyy"}}

The donor.last_gift_date portion identifies the field, while the formatting after the vertical bar tells DonorDock how the date should appear.

An underlying value may contain both a date and time:

6/6/2023 3:35:01 PM

With:

| date:"MMMM dd, yyyy"

the same value displays as:

June 06, 2023

The individual parts of the date format determine how the date is displayed:

Date Format

Meaning

Example

MMMM

Full month name

June

dd

Two-digit day of the month

06

yyyy

Four-digit year

2023

Combined as:

MMMM dd, yyyy

the finished date appears as:

June 06, 2023

This provides a cleaner donor-facing date and removes extra information, such as the time of day, when it isn't needed.

Phone Formatting

Some phone number merge tags include:

| phone

For example:

{{donor.mobile_phone | phone}}

The | phone instruction tells DonorDock to apply the supported phone number formatting when the value is generated rather than displaying the underlying value as plain text.

This helps phone numbers appear more consistently within communications.

Conditional Formatting: Add Text Only When a Value Exists

In addition to formatting how a merge tag value appears, DonorDock supports conditional formatting filters that let you add text before or after a merge tag only when that merge tag contains a value.

This is useful when a word, space, punctuation mark, or other piece of text should appear only when the associated field is populated.

The two conditional formatting filters are:

  • prepend_if_value adds text before the merge tag value.

  • append_if_value adds text after the merge tag value.

These filters can be used in both regular DonorDock templates and Microsoft Word templates.

⚠️ Keep the Entire Filter Inside the Double Braces Just like other merge tag formatting instructions, conditional filters are part of the merge tag itself.

The merge tag, the filter, and the text you want the filter to add must all remain inside the same set of double braces: {{ }}

For example:

{{gift.campaign.name | prepend_if_value:" for "}}

Add Text Before a Value with prepend_if_value

Use prepend_if_value when you want text to appear immediately before a merge tag, but only when the merge tag contains a value.

For example:

{{gift.campaign.name | prepend_if_value:" for "}}

If the Campaign is Annual Campaign, the generated result is:

for Annual Campaign

If the Campaign field is blank, the generated result is blank. The words for are not included.

This is especially useful when adding a merge tag to a sentence.

For example:

Your gift{{gift.campaign.name | prepend_if_value:" for "}} makes a difference.

If a Campaign is present, this will generate as:

Your gift for Annual Campaign makes a difference.

If the Campaign is blank:

Your gift makes a difference.

Because the preceding space and the word for are contained within the filter, they are only inserted when the Campaign has a value.

Add Text After a Value with append_if_value

Use append_if_value when you want text or punctuation to appear immediately after a merge tag, but only when the merge tag contains a value.

For example:

{{gift.campaign.name | append_if_value:","}}

If the Campaign is Annual Campaign, the generated result is:

Annual Campaign,

If the Campaign is blank, neither the Campaign name nor the comma is displayed. The text added by the filter can include spaces, punctuation, or words, depending on how the merge tag needs to fit into the surrounding content.

Using Both Filters Together

You can use prepend_if_value and append_if_value on the same merge tag.

Each filter is separated by a pipe |, and the entire expression remains inside the same set of double braces.

For example:

{{gift.campaign.name | prepend_if_value:" for " | append_if_value:"."}}

If the Campaign is Annual Campaign, the generated result is:

for Annual Campaign.

If the Campaign is blank, the entire result is blank. Neither for nor the period is displayed.

This can be especially helpful when an optional merge tag needs surrounding words or punctuation that should disappear along with the value when the field is empty.

Conditional Formatting vs. Automation Logic

These filters provide conditional formatting around an individual merge tag. They allow DonorDock to add specified text before or after a value only when that merge tag contains data, helping optional content read naturally without leaving behind unnecessary words, spaces, or punctuation.

They are not full If...Then...Else rules and do not change larger sections of a template based on the details of a gift or contact.

If you need entirely different content to be generated or sent based on specific gift details, such as the Campaign, Fund, Appeal, gift amount, or other criteria, consider using DonorDock Automations instead. With an Automation, you can use the gift details as conditions and direct qualifying gifts or donors into different workflows, each using the appropriate email or letter template.

In other words, conditional merge tag filters are best for adjusting small pieces of content within a template, while Automations are better when gift details should determine which template or communication is used.

Microsoft Word Templates

The same prepend_if_value and append_if_value syntax can be used in Microsoft Word templates.

When using these filters in Word, make sure the quotation marks around the text being added remain straight double quotes:

"

Microsoft Word may automatically replace straight quotation marks with curved or “smart” quotation marks. Curved quotation marks can prevent DonorDock from interpreting the filter correctly.

For example, this should remain:

{{gift.campaign.name | prepend_if_value:" for "}}

with straight quotation marks around for.

Remember

Conditional formatting follows the same basic structure as other merge tag formatting:

{{merge_tag | filter:"formatting instructions"}}

Formatting Is Part of the Merge Tag

Formatting instructions are part of the complete merge tag and should remain inside the double braces.

For example:

{{gift.received_amount | currency}}

and:

{{gift.received_amount}}

both reference the same Gift field, but they may not display the value the same way. The first version specifically instructs DonorDock to format the value as currency.

💡 Formatting changes how a value appears, not the information stored in DonorDock. A Gift amount of 1500 remains the same amount whether it is displayed as 1500 or $1,500.00.

Avoid Manually Altering Merge Tag Syntax

When using a merge tag supplied by DonorDock, keep the entire tag intact.

Avoid manually changing:

  • The opening or closing braces

  • The field name

  • Periods or underscores within the field name

  • The vertical bar

  • Formatting instructions

  • Quotation marks within date formatting

Even a small change can prevent DonorDock from recognizing the tag correctly or cause the value to display differently than expected.

Whenever possible, insert merge tags using the available Merge Tag selector or copy the complete tag from DonorDock rather than typing it manually.

Test Merge Tags After Adding Them

After adding or updating merge tags, generate a test of the template to confirm that the values populate and display correctly.

Pay particular attention to:

  • Currency symbols and decimal places

  • Date formatting

  • Phone number formatting

  • Spacing around populated values

  • Punctuation surrounding the merge tag

  • Merge tags that remain visible instead of being replaced

If a merge tag appears in the finished test exactly as it was entered, first confirm that the full double-brace structure and the complete tag syntax are still intact.

Keeping the merge tag exactly as provided and testing the finished communication are the best ways to make sure personalized information generates as intended.

Was this guide helpful?