Klaviyo merge tags: first name default, custom HTML and DKIM

Klaviyo leaves {{ first_name }} blank when a profile has no name. Add the default filter, import custom HTML with an unsubscribe tag, and set up DKIM.

85 KB

Estimated size under which Klaviyo's preview says an email is not at risk of Gmail clipping
On this page
  1. How do Klaviyo personalization tags work?
  2. How to set a default for an empty first name in Klaviyo
  3. Can you personalize a Klaviyo subject line?
  4. How to preview a Klaviyo email as a profile with no first name
  5. How to import a custom HTML template into Klaviyo
  6. What width and size should a Klaviyo email template be?
  7. How to set up a Klaviyo branded sending domain
  8. Sources

In Klaviyo the first-name tag is {{ first_name }}, and when a profile has no first name and no default text, the first name is left blank, so the greeting would read "Hey ,". Give it a fallback with the default filter, {{ first_name|default:'there' }}, or type the word into Default text when you insert the tag from the personalization menu. Klaviyo calls these personalization tags; other platforms call them merge tags.

The tag Klaviyo inserts with Default text “there” and title case

{{ person.first_name|title|default:'there' }}

  1. person.first_nameThe profile's first name. Klaviyo says the shorter first_name works the same.
  2. |titleFilter one, applied first: title case, so mary jane becomes Mary Jane.
  3. |default:'there'Filter two: the word printed when the profile has no first name.

What each profile receives

The profile's first nameThe tag aloneHey {{ first_name }},The tag aboveHey {{ person.first_name|title|default:'there' }},
first_name: "Ada"
The tag alone

Hey Ada,

The tag above

Hey Ada,

first_name: "mary jane"
The tag alone

Hey mary jane,

The tag above

Hey Mary Jane,

first_name: not set
The tag alone

Hey (nothing),

Left blank
The tag above

Hey there,

Orange: the default, and the blank that goes out without one

Example. The tag Klaviyo's personalization menu inserts, and the greeting three profiles receive from it and from the bare tag. From Klaviyo's first name guide, which gives the “Hey ,” result and the mary jane example, and its filter guide, read 31 October 2026.

How do Klaviyo personalization tags work?

Klaviyo puts variables in two pairs of curly brackets and template tags in curly brackets with percent signs, and supports no other kind. A filter after a pipe changes what a variable prints. The tags a template uses most, from the message personalization reference:

TagWhat it prints
{{ first_name }}, {{ last_name }}The profile's first and last name
{{ email }}The profile's email address
{{ person.property_name }}A custom profile property
{{ person|lookup:'property name' }}A custom property whose name has spaces
{{ event.property_name }}Data from the event that triggered a flow
{{ organization.name }}, {{ organization.full_address }}Your company name and mailing address from account settings
{% unsubscribe %}A whole link that says Unsubscribe
{% unsubscribe_link %}The unsubscribe URL alone, for an href
{% manage_preferences_link %}The URL of the profile's preference page
{% web_view_link %}The URL of the browser version

How to set a default for an empty first name in Klaviyo

In a text block, click the personalization icon, select First name, enter a word in Default text, choose a capitalization and click Insert (Klaviyo's first name guide). With "there" and title case, the editor writes:

{{ person.first_name|title|default:'there' }}

The shorter {{ first_name|title|default:'there' }} also works. Filters run in order, so the name is title-cased first and the default supplies a word if no first name has been provided. Typed by hand, three rules from the filter guide apply:

  • No spaces around the colon. Klaviyo's own examples write the pipe with and without spaces.
  • Matching straight quotes, single or double, never a word processor's curly ones.
  • Paste as plain text, with Ctrl+Shift+V or Cmd+Shift+V, so no formatting lands inside the tag.

A default swaps one word for everyone. To change the whole line, use an {% if %} block with {% else %} and {% endif %}, which the reference documents for conditional content.

Can you personalize a Klaviyo subject line?

Yes. Klaviyo's page on names and fallbacks lists subject lines, preheaders, headings and body text, and its subject line example carries the default:

Hi {{ first_name | default:'there' }}, your order has shipped

Link and preview tags only work in email templates, and event personalization is not supported in campaigns, only in a flow triggered by that event. Klaviyo's pages do not say whether a profile tag works inside a link's URL.

How to preview a Klaviyo email as a profile with no first name

Click Preview and use Search profiles to pick a real profile, once with a first name and once without (Klaviyo's preview guide). Unlike a Mailchimp test, a Klaviyo test send carries real values: every test recipient sees the personalization of the profile selected in the preview. Unsubscribe and web view links lead to placeholder pages in tests, so check those with a live send to an internal list.

A preview that says Message displayed without tags or variables has a tag Klaviyo could not render; Could not parse the remainder means a stray quote, a spaced property name or a malformed filter.

How to import a custom HTML template into Klaviyo

As of October 2026 the path is Content, Templates, the Email: saved tab, then Create and Import email template (Klaviyo's import guide). Upload a .html file or choose Paste HTML. Local images go in a .zip, each path matching its reference and each image 10 MB or smaller, and Klaviyo moves them to its CDN. Remove the other platform's tags first. Klaviyo also advises against importing a template exported from its own drag and drop editor, which "can cause problems with the template's functionality".

Which unsubscribe tag does Klaviyo require?

Marketing templates need one, and import checks: Klaviyo's custom HTML template errors include "An {% unsubscribe %} tag is required". The non-marketing box skips the check, for triggered emails only. If a marketing email still goes out without one, Klaviyo adds an unsubscribe link at the bottom, in its default footer.

{% unsubscribe %} writes a whole link, so inside an href or a button it breaks. For your own link, Klaviyo's example puts the URL tag in the href:

<a href="{% unsubscribe_link %}" style="color: red;">Unsubscribe here.</a>

Klaviyo adds the one-click unsubscribe header itself. For the postal address, fill in your company details under Settings, General, Account and put {{ organization.name }} and {{ organization.full_address }} in the footer. Klaviyo calls the address important in order to comply with certain regulations, like CAN-SPAM, though the pages we read describe no check for it.

What does Klaviyo change in pasted HTML?

On import or save, Klaviyo removes disallowed elements such as script and iframe, converts unrecognized tags to span, and removes unsupported attributes. JavaScript, embedded forms and videos do not survive, and a custom HTML template cannot use product feeds.

How to make regions editable in a hybrid template

A hybrid template keeps your custom HTML and adds drag and drop blocks only in regions you mark. Each region is a table cell with its width in pixels (Klaviyo's hybrid template guide):

<td align="center" data-klaviyo-region="true" data-klaviyo-region-width-pixels="600">
    <div class="klaviyo-block klaviyo-image-block"></div>
</td>

klaviyo-text-block in place of klaviyo-image-block gives a text block. Add the imported template to a campaign or flow and choose Drag and drop to use the regions. Keep hand-tuned code such as an Outlook-safe button outside them.

What width and size should a Klaviyo email template be?

The drag and drop editor's default width is 600px, changed under Edit styles, and Klaviyo does not recommend going wider unless an advanced layout needs it. Image blocks scale to fit, but custom HTML with fixed widths does not, so keep those within the template's width.

For size, the preview sidebar estimates Total size and the risk of Gmail clipping: under 85 KB, no risk; 85 KB to under 95 KB, possible; 95 KB or more, likely. The size shown is rounded to the nearest 5 KB, so read the risk message too. Only code counts, not image files, and Klaviyo suggests checking inside a campaign or flow so UTM parameters are included. More in the Gmail clipping guide.

How to set up a Klaviyo branded sending domain

Until you do, most accounts send from a shared domain, and inboxes show "via klaviyomail.com" beside your address (Klaviyo's setup guide). Klaviyo calls the fix a branded, or dedicated, sending domain. As of October 2026: your company name, Settings, Domains, Add domain. Choose the email type (Marketing, Transactional or Service), name an unused subdomain ("send" is the most common) and a routing type:

  • Dynamic, which Klaviyo recommends: four NS records delegate the subdomain to Klaviyo, which then hosts its DNS, DKIM keys included.
  • Static, for DNS hosts without NS records: three CNAMEs, one for the subdomain and two for DKIM.

Both add a TXT record at the root domain to prove ownership.

Static routing

Three CNAMEs, for a DNS host without NS records. The selector names the send type.

  • Sending subdomainCNAME

    Hostsend.example.comValue1.klaviyodns.com
  • DKIM, first keyCNAME

    Hostkm1._domainkey.example.comValuekm1._domainkey.1.klaviyodns.com
  • DKIM, second keyCNAME

    Hostkm2._domainkey.example.comValuekm2._domainkey.1.klaviyodns.com

Dynamic routing, which Klaviyo recommends

Four NS records hand the subdomain to Klaviyo, which hosts every record under it.

  • Delegation, four recordsNS

    Hostsend.example.comValuens1.klaviyo.com
    ns2.klaviyo.com
    ns3.klaviyo.com
    ns4.klaviyo.com
  • DKIM, nothing for you to add

    Klaviyo serves the keys inside the delegated zone, at selectors such as mtd. Seen in public DNS:

    mtd1._domainkey.send.example.com

For either routing type

  • Domain ownershipTXT

    Hostexample.comValueklaviyo-site-verification=public_API_key
  • DMARC, offered only if the domain has noneTXT

    Host_dmarc.example.comValuev=DMARC1; p=none;
  • SPFNone

    Not asked for. The subdomain's records connect it to SPF that Klaviyo manages.

Underlined in orange: the DKIM selector

Example. The records for a marketing sending domain of send.example.com, laid out as in Klaviyo's branded sending domain guide. The values in your account differ, so copy them from the setup screen. Selector names from Klaviyo's DNS and SPF troubleshooting and header guide; the mtd1 host was read from public DNS on two dynamically routed domains on 31 October 2026.

Which DKIM selectors does Klaviyo use?

With Static routing the selector depends on the send type:

DomainDKIM selectors
Marketingkm1, km2
Transactionalkt1, kt2
Serviceks1, ks2
A second domain of the same typeThe next pair, such as km3, km4
Static domains set up before send typeskl1 and kl2, or kl and kl2

Dynamic domains can use other selectors, such as mtd, served from the zone Klaviyo hosts. On two dynamic domains we checked in public DNS on 31 October 2026, a key sat at mtd1._domainkey under the sending subdomain.

If your DNS host appends the domain, send.example.com becomes send.example.com.example.com, so enter only send (troubleshooting guide). Keep the underscores in DKIM hosts, and turn off proxying, which Klaviyo says commonly gets in the way on Cloudflare.

Does Klaviyo need an SPF record?

No. Klaviyo says you do not need to add a separate SPF TXT record: the NS or CNAME records connect your subdomain to SPF that Klaviyo manages. Its static example points the subdomain at 1.klaviyodns.com, which on 31 October 2026 publishes v=spf1 include:spf.klaviyodns.com ~all. Your root SPF record stays as it is, under its limit of 10 lookups.

Does Klaviyo's DKIM align with your From domain for DMARC?

Not on the shared domain, where your From domain does not align with Klaviyo's sending domain. A branded sending domain aligns DKIM with your From domain, and under relaxed alignment the two only need to share a root domain. Send from the root, such as name@example.com: an address on the sending subdomain will not receive replies.

With no DMARC record in place, setup offers Add DMARC record, which generates v=DMARC1; p=none;. If you have one, Klaviyo says to review it rather than add a second. Add a rua address so reports reach you.

Yes, with dedicated click tracking on a paid plan (Klaviyo's click tracking guide). A dynamic marketing domain can create trk.send.example.com with no DNS change; otherwise add a CNAME such as trk to dct.klaviyodns.com and a TXT at the root.

How to check it once it is live

The Domains page moves from Verifying to Verified, or to Action required or Failed. Records can take 48 hours, and nothing sends from the domain until you click Activate. From outside, for a static marketing domain:

dig +short CNAME send.example.com
dig +short CNAME km1._domainkey.example.com
dig +short CNAME km2._domainkey.example.com
dig +short TXT _dmarc.example.com

For a dynamic domain, dig +short NS send.example.com should list Klaviyo's name servers. Then read a live email's Authentication-Results header for dkim=pass, the selector in header.s, and dmarc=pass (Klaviyo's header guide), or paste it into the header analyzer.

The free mail-merge preview flags every empty merge field in a list exported from Klaviyo, and the DKIM checker reads a key by selector, such as km1. The editor exports Klaviyo HTML with {{ first_name|default:'there' }} fallbacks and the unsubscribe and web view links set to {% unsubscribe_link %} and {% web_view_link %}. Draftship also builds and runs outbound inside a client's own platform.

Sources

  • help.klaviyo.comthe first name is left blank, so the greeting would read "Hey ,"
  • help.klaviyo.comKlaviyo calls these personalization tags; other platforms call them merge tags
  • help.klaviyo.comvariables in two pairs of curly brackets and template tags in curly brackets with percent signs
  • help.klaviyo.comThe tags a template uses most, from the message personalization reference
  • help.klaviyo.comif no first name has been provided
  • help.klaviyo.comevent personalization is not supported in campaigns
  • help.klaviyo.comClick Preview and use Search profiles to pick a real profile, once with a first name and once without
  • help.klaviyo.comA preview that says Message displayed without tags or variables has a tag Klaviyo could not render; Could not parse the remainder means a stray quote, a spaced property name or a malformed filter
  • help.klaviyo.comadds an unsubscribe link at the bottom
  • help.klaviyo.comimportant in order to comply with certain regulations, like CAN-SPAM
  • help.klaviyo.comremoves disallowed elements such as script and iframe, converts unrecognized tags to span, and removes unsupported attributes
  • help.klaviyo.comKlaviyo's hybrid template guide
  • help.klaviyo.comdefault width is 600px
  • help.klaviyo.comFor size, the preview sidebar estimates Total size and the risk of Gmail clipping: under 85 KB, no risk; 85 KB to under 95 KB, possible; 95 KB or more, likely
  • help.klaviyo.comUntil you do, most accounts send from a shared domain, and inboxes show "via klaviyomail.com" beside your address
  • help.klaviyo.comdepends on the send type
  • help.klaviyo.comkl1 and kl2, or kl and kl2
  • help.klaviyo.comcan use other selectors, such as mtd
  • dns.googlepublishes v=spf1 include:spf.klaviyodns.com ~all
  • help.klaviyo.comdoes not align with Klaviyo's sending domain
  • help.klaviyo.comKlaviyo's click tracking guide

Who do you want to hear back from?

Tell us who you sell to and what you have tried. We'll get back to you ASAP, and if it looks like a fit, we build it into your systems within days.

Or write to hello@draftship.io