Skip to main content

How to personalize your templates using merge variables?

This guide explains how to use merge variables in PostGrid’s Template Editor to personalize your letters, postcards, and self-mailers with dynamic, recipient-specific content.

Updated over a week ago

Overview

Merge variables allow you to insert dynamic data into your mail pieces — such as names, promo codes, custom fields, or even personalized images. When your campaign runs, PostGrid replaces these placeholders with values from your mailing list, enabling fully customized communications for each recipient.


How to Use Merge Variables

Using merge variables involves two steps: adding the variable to your template and providing the matching data in your mailing list.

Text Merge Variables

  1. Add a text element
    In the Template Editor, drag a Text element onto your design.

  2. Insert default variables
    PostGrid provides built-in variables for recipient and sender details (e.g., name, address).
    Example:

    Hello, {{to.firstName}}

    Default recipient variables use the format {{to.variableName}}; sender variables use {{from.variableName}}. You can find a list of all default merge variables values here.

  3. Insert custom variables
    For anything not included in the default set — like promo codes or membership IDs — create your own variable:

    Your promo code is: {{code}}

    Important: The variable name (e.g., code) must match a column header in your mailing list CSV exactly, including case.

  4. Save your template
    Click Save Template to apply the changes.

Image Merge Variables

  1. Add an image variable
    In the left sidebar, open Merge Variables and drag the Image element onto your template.

  2. Name your variable
    With the image element selected, update the Merge Variable field (e.g., itemImage).

  3. Prepare your mailing list
    Add a column to your CSV using that exact name (itemImage). Each row must contain a publicly accessible image URL.

  4. Save your template
    PostGrid will replace the placeholder with the image linked in each row of your list.


FAQ

Q: Can I use merge variables with PDF uploads?
A: Not directly. However, you can upload your PDF as an image in the Template Editor and overlay text elements containing merge variables.

Q: What happens if a variable is missing from my list?
A: Missing values typically render as blank fields. Test your template to confirm how empty data behaves in your workflow.

Q: Are custom merge variables case-sensitive?
A: Yes. The template variable and the CSV column header must match exactly.

Q: Where can I find the list of default merge variables?
A: In the PostGrid documentation under Creating Templates Using Template Editor → Acceptable Default Merge Variable Values for Contacts.

Q: What kind of URLs should I use for image variables?
A: Use publicly accessible URLs — PostGrid must be able to fetch the image during rendering.

Did this answer your question?