Convertkit Event Listener
How to track Convertkit Form Submission with google tag manager
Enhance your marketing data with ConvertKit conversion data. If you use the ConvertKit form for lead capturing, you can track successful form submissions as conversions using GTM and this ConvertKit event listener code.
Start by creating a custom HTML tag type, where you’ll be pasting the listener code there.
This code pushes a dataLayer event when a user successfully submits a Convertkit form with the event name [converkitform.submit]
The next step is to create a custom event trigger using that event name, this trigger will be used to fire your marketing tags/pixels.
To capture the form details like form ID and user ID in the form database, you can use the following dataLayer variables;
[convertKitFormId] –> returns the ConvertKit form ID
[convertkitUserId] –> returns the userID in the form database
with this you can enrich your marketing data in your analytics and advertising platform.
<script type="text/javascript"> (function() { document.addEventListener("submit", function(a) { a.target.getAttribute("data-sv-form") && window.dataLayer.push({ event: "converkitform.submit", convertKitFormId: a.target.getAttribute("data-sv-form"), convertkitUserId: a.target.getAttribute("data-uid") }) }, !0) })(); </script>