Klaviyo Form Event Listener
How to track Klaviyo Form Submission with google tag manager
If you are using the Klaviyo form for capturing leads on your website, with the help of Google Tag Manager and this Klaviyo form event listener, you’ll be able to track successful form submissions as conversion
Implementing this is easy, start by creating a custom HTML tag type, where you’ll be pasting the event listener javascript code, save the tag and add a pageview or DOM-ready trigger
Next is to create a custom event trigger with the event name as [klaviyoFormSubmission]
To capture the form ID, form title and submitted visitor email, created the following dataLayer variables with the following keys;
[formId] –> for the form ID
[formTitle] –> for the form title
[formEmail] –> for the user submitted email
🏆 Credit:
The creator of this code is Julius Fedorovicius (only the key that captures the submitted email was added to this script)
<script> window.dataLayer = window.dataLayer || []; window.addEventListener("klaviyoForms", function(e) { if (e.detail.type == 'submit') { dataLayer.push({ 'event' : 'klaviyoFormSubmission', 'formId' : e.detail.formId, 'formTitle' : e.detail.metaData.$source, 'formEmail': e.detail.metaData.$email }); } }); </script>