Klaviyo

Subscribe or unsubscribe Klaviyo profiles and track events from your forms.

Klaviyo sends each form submission to your Klaviyo account. An action can subscribe the profile to a list, unsubscribe it, or record an event that starts a Klaviyo flow. It needs XPAC Forms.

Connect Klaviyo

In Klaviyo, click your organization name at the bottom left, choose Settings, open API keys and click Create Private API Key. Choose Custom and give full access to Lists, Profiles, Subscriptions and Events, and read access to Accounts. Copy the key right away: Klaviyo shows it only once. The public site key won't work.

In WordPress, go to XPAC → Integrations → Klaviyo, paste the key (it starts with pk_) into API key and save. Admins can see the saved key on this screen.

Click Test connection. It checks that the key can read your lists and shows how many it found. It sends nothing. A key that can only read passes this test but can't subscribe anyone, so check the access above.

Add it to a form

Edit the form, open the Klaviyo panel in the sidebar and click Add Klaviyo action. Only administrators can change Klaviyo actions. Pick the Action:

  • Subscribe to list: choose the List, then Record consent for: Email marketing, Email and SMS marketing, or No consent (list only). Consent source is an optional label for where consent was collected.
  • Unsubscribe: under Unsubscribe from, One list only unsubscribes people who are on that list. All email marketing unsubscribes them from email marketing across your Klaviyo account.
  • Track event: enter a Metric name. Klaviyo creates the metric on the first submission, and you can use it to trigger a flow.

Then pair each Form field with a Klaviyo field: email address, phone number, name, location fields, or a Custom property you name. One row must map to Email address, and only mapped values are sent. For an event, custom properties are sent as event properties, along with the form ID.

  • The action records consent on every submission it runs for. To record it only when a box is ticked, add a condition with Forms' conditional logic.
  • The list's own opt-in setting decides confirmation. On a double opt-in list, people join after they confirm by email. With No consent (list only), they join straight away with no confirmation email, and Klaviyo can email them but can't text them.
  • Email and SMS marketing needs a phone number row. Phone numbers are sent in international format: a US-format Phone field gets +1, and other numbers need a country code, like +44. A Smart international Phone field already sends +CC numbers, and a phone format from an add-on that declares a country code gets that code. A number without one is left off the profile with a note, and only email consent is recorded.
  • Lists are kept for 10 minutes. Click Reload lists from Klaviyo to fetch them again. A list deleted in Klaviyo is flagged on its action.

Click Save, then update the form. Each action has a switch to turn it off, and Edit Klaviyo action and Remove Klaviyo action buttons. The XPAC Agent can add these actions for you too.

When a send fails

XPAC saves every submission first and sends it to Klaviyo in the background, so a Klaviyo problem never loses a submission. Each send is listed under XPAC → Forms → Deliveries:

  • Delivered: Klaviyo took it. A note says when something was left out, such as a phone number without a country code, or when an unsubscribe found nobody on the list.
  • Waiting: queued, or waiting to try again. When Klaviyo is busy or can't be reached, XPAC tries again after about 1, 5, 30 and 120 minutes.
  • Failed: every try failed, or Klaviyo refused this profile. The row says why.
  • Skipped: there was nothing to send, such as a submission with no email address, or no phone number for Email and SMS marketing.
  • Dismissed: you dismissed it, or the submission is in spam or the trash.

Retry now sends a failed or dismissed delivery again with the form's current settings and the API key saved now. Actions that already went through are not sent again unless you edited them since.

If five deliveries in a row fail because of the account or the connection, such as a revoked key or Klaviyo being down, XPAC pauses Klaviyo on that form. A problem with one person's answers never counts. While it is paused, submissions are still saved but show as Failed, and the site's admin email address gets one email about it. XPAC still tries one submission an hour, and Klaviyo starts sending again on its own if that one goes through. To resume now, fix the cause and click Resume and retry on the Deliveries screen. It sends the failed submissions again with the form's current settings.

For developers

HookTypeWhat it does
xpac_klaviyo_typed_propertiesFilterReturn true to send a custom property as a number, true/false or list instead of text. Gets the property name and the form field. Default false.
xpac_klaviyo_default_phone_countryFilterCalling code for a phone number typed without one. Default 1 for a US-format Phone field, the calling code of an add-on phone format that declares one, otherwise empty. Gets the form field.
xpac_klaviyo_request_timeoutFilterSeconds to wait for Klaviyo. Default 10.
xpac_klaviyo_api_revisionFilterThe Klaviyo API revision the site uses, as YYYY-MM-DD.

On this page