Skip to main content

Klaviyo Form GTM Event Listener

Track Klaviyo email signup form submissions in Google Tag Manager. Capture formId, formTitle, and formEmail and fire GA4 events on klaviyoFormSubmission.

klaviyoemail-marketingecommerceformsgtmga4

Event fired

klaviyoFormSubmission

Key variable

formId

Klaviyo

Overview

Klaviyo is an email marketing and SMS platform used primarily by eCommerce stores. Its forms, pop-ups, flyouts, embedded, dispatch klaviyoForms events. This listener intercepts those events and pushes submission data to the GTM dataLayer.

Event fired: klaviyoFormSubmission Variables: formId, formTitle, formEmail Credit: Julius Fedorovicius (email field added by DumbData)

Why Use This Listener

Klaviyo's forms are critical lead capture and email list growth tools. Without this listener, you cannot:

  • Track email sign-ups as GA4 conversions
  • Fire Meta's Lead event on Klaviyo sign-up
  • Know which Klaviyo form (pop-up vs. embedded) converts better
  • Capture the email address for enhanced conversions

Common Use Cases

  • Track newsletter and discount email sign-ups as GA4 conversions
  • Fire Lead event to Meta on Klaviyo form submission
  • Measure pop-up vs. embedded form conversion rates
  • Use sign-up events to build Google Ads RLSA audiences
  • Send hashed email to Google for Enhanced Conversions
  • Connect Klaviyo sign-ups to purchase data in GA4

How It Works

Klaviyo dispatches a custom event named klaviyoForms on the window. The listener filters for submit event types and pushes the form ID, title, and email to the dataLayer.

Installation

html
<!-- GTM Custom HTML Tag: Klaviyo Form Listener -->
<script>
window.addEventListener('klaviyoForms', function(e) {
  if (e.detail.type === 'submit') {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'event': 'klaviyoFormSubmission',
      'formId': e.detail.formId,
      'formTitle': e.detail.metaData.$source,
      'formEmail': e.detail.metaData.$email
    });
  }
});
</script>

Fire on: All Pages (Pageview).

Data Layer Output

json
{
  "event": "klaviyoFormSubmission",
  "formId": "RaMkJd",
  "formTitle": "Summer Sale Popup",
  "formEmail": "customer@example.com"
}

Trigger Configuration

Trigger Type: Custom Event Event Name: klaviyoFormSubmission

Variables to Capture

Variable NameDL KeyExample
DLV – Klaviyo Form IDformId"RaMkJd"
DLV – Klaviyo Form TitleformTitle"Summer Sale Popup"
DLV – Klaviyo EmailformEmail"user@example.com"

GA4 Mapping Recommendations

GA4 EventParameterValue
sign_upmethod"klaviyo"
sign_upform_idDLV – Klaviyo Form ID
sign_upform_nameDLV – Klaviyo Form Title
sign_upemailDLV – Klaviyo Email (hashed for Enhanced Conversions)

Debugging

ProblemCauseFix
Event not firingklaviyoForms event not dispatchedConfirm Klaviyo script is loading
formEmail is emptyEmail field not named emailCheck Klaviyo form field name mapping
Fires on open, not submitMissing type === 'submit' filterAdd the filter check

Best Practices

  1. Use sign_up not generate_lead for email subscriptions, better GA4 taxonomy alignment
  2. Hash the email before pushing to dataLayer if using Enhanced Conversions
  3. Capture formTitle, it makes GA4 reports more readable than raw form IDs
  4. Create per-form-type events, popup sign-ups vs. embedded sign-ups have different intent signals

Performance Considerations

  • One window.addEventListener call, zero performance impact
  • The klaviyoForms event fires asynchronously after Klaviyo processes the submission

Related Listeners