Klaviyo
What it does
Sends the person behind each new submission of a form to Klaviyo. You choose how:
- Identify creates the person's Klaviyo profile, or updates it when one exists.
- Track records an event with the name you give, such as
Requested a Quote, on the person's profile. You can use the event to start a Klaviyo flow.
Either way, the person can also be subscribed to Klaviyo lists.
What Klaviyo receives:
- the email address, and the first and last name. The name comes from the customer account when a signed-in
customer sends the form. For a guest, the submitter name of the form goes in the last name, or
Guestwhen the form has none. See Submission Identity in Form settings; - the fields you map, such as a phone number, a company or an address;
- with Track, the time of the submission.
Answers you don't map aren't sent.
Install
composer require mageme/module-webforms-addon-klaviyo
bin/magento setup:upgrade
Settings
Connect your Klaviyo account
Go to Stores → Configuration → MageMe Extensions → WebForms, expand Integrations, then Klaviyo. Enter your Klaviyo Public API Token and Private API Token and click Save Config.
These settings can differ per store view, so each store view can send to its own Klaviyo account.
Choose what a form sends
- Go to Content → WebForms → Manage Forms and click the form's name.
- Under Form Information, click Klaviyo Integration Settings.
- Select Yes in Enable Klaviyo Integration.
- In Endpoint, select Identify or Track. For Track, enter the event's name in Event.
- In Customer Email, keep Default or pick the form's email field. Default is the address in the form's Submitter Email setting, or the customer account's address.
- In Add Profile to Lists, pick the lists to subscribe the person to, if any.
- Under Fields Mapping, click Add for each profile field you want to fill. Pick it in Klaviyo Attribute and the form field in Field.
- Click Save.
Klaviyo Attribute offers the profile fields, such as Phone number in E.164 format (e.g., "+13239169023"), Organization, City and Postal Code, and two special ones:
| Attribute | What the mapped field does |
|---|---|
| Consent (e.g. ['sms', 'email', 'web', 'directmail', 'mobile']) | Gives marketing consent for the channels the visitor picks. The field's options must be the channel names email, sms, web, directmail or mobile. |
| Custom property (Field label) | Saves the answer on the profile under the field's label. |
Your lists come from your Klaviyo account. On a saved form, click Refresh Lists in the section to load them.
Subscriptions and consent
With lists in Add Profile to Lists, WebForms asks Klaviyo to subscribe the person to each list on every submission, whether or not the form asks for consent. Pick lists only on forms that collect the person's permission, for example with a field mapped to Consent or a checkbox the visitor must tick. Without lists, a field mapped to Consent still subscribes the person to the channels they picked.
How it works
When a visitor submits the form, WebForms saves the submission and then queues it for Klaviyo. The queue is worked through by Magento's scheduled tasks (cron), so the profile or event appears shortly after the visit. A form set to Do Not Store Submissions sends during the visit instead. Editing a submission later doesn't send it again.
A submission needs an email address or a phone number mapped to the Phone number in E.164 format attribute. One with neither is skipped, and so is every submission when Track has no event name.
To send submissions that already exist, or to send one again:
- Go to Content → WebForms → Manage Forms.
- In the form's row, click Select in the Actions column, then click Browse Results.
- Select the checkboxes of the submissions.
- Click Actions, then Send to Klaviyo, and confirm.
WebForms reports how many submissions were sent, skipped and failed. Send to Klaviyo is in the menu only while the integration is on for the form and both tokens are saved, and only for admins with the Edit Result permission.
A repeated Identify updates the same profile. With Track, every event carries a key of its submission, the same on every send, so Klaviyo can recognise a repeated send of the same submission.
To check that it worked, open the person's profile in Klaviyo. WebForms doesn't mark a submission as sent.
Troubleshooting
- Nothing reaches Klaviyo. Check that Enable Klaviyo Integration is on for the store view the form was sent
from, that Endpoint is chosen, and that both tokens are saved for that store view. Ask whoever runs your server
to check that Magento cron is running and to search Magento's system log for "Klaviyo" in any letter case. The
lines about sending start with "WebForms integration" and name the service in lowercase, as
klaviyo. A skipped submission is logged with the reason, such as "Klaviyo is not configured". - The profile is there but not on the list. A failed subscription is written to the log and isn't tried again. Check the list in Klaviyo and send the submission again from the list of submissions.
- The log says Klaviyo answered "HTTP 401". A line such as "Klaviyo Client error on … HTTP 401, errors …" means Klaviyo didn't accept the private token. WebForms tries three times and then gives up. Sending from the list reports "Klaviyo did not accept the credentials". Enter a valid token, save, and send the waiting submissions again from the list.
- Klaviyo refused the data, for example a phone number that isn't in the
+country code format. WebForms doesn't try again. Correct the cause and send the submission again from the list. - Klaviyo didn't answer, or answered with a server error or "too many requests". WebForms tries again, up to three tries in all, waiting longer before each one. After the third failure it gives up and writes an error to the log.
What's next
- Settings: Integrations: the Klaviyo connection.
- Integrations: the other services WebForms can send to.
- Phone field: collect phone numbers in the format Klaviyo needs.