Last active
April 23, 2024 02:01
-
-
Save svaustin66/e4298d9c28902e91a6ad31969178ae2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Tracking Klaviyo Sign-ups in GA4 --> | |
<script> | |
window.addEventListener("klaviyoForms", function(e) { | |
if (e.detail.type == 'open' || e.detail.type == 'embedOpen') { | |
gtag('event', 'klaviyo_form_open', {'form': 'Klaviyo form', 'form_id': e.detail.formId}); | |
} | |
if (e.detail.type == 'submit') { | |
gtag('event', 'klaviyo_form_submit', {'form': 'Klaviyo form', 'form_id': e.detail.formId}); | |
} | |
if (e.detail.type == 'stepSubmit') { | |
gtag('event', 'klaviyo_form_step_submit', {'form': 'Klaviyo form', 'step_name': e.detail.metaData.$step_name}); | |
} | |
if (e.detail.type == 'redirectedToUrl') { | |
gtag('event', 'klaviyo_form_url_redirect', {'form': 'Klaviyo form', 'form_id': e.detail.formId}); | |
} | |
if (e.detail.type == 'close') { | |
gtag('event', 'klaviyo_form_close', {'form': 'Klaviyo form', 'form_id': e.detail.formId}); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment