Typeform is one of the popular form builders, offering numerous features and functionalities. In today’s tutorial, I’ll be covering TypeForm tracking using Google Tag Manager. These instructions apply to both the free and paid versions of Typeform, and you won’t need to insert any GTM script inside Typeform.
Typeform GTM DataLayer Code
<script>
/**
* Author: Md Hasanuzzamna
* Linkedin: https://linkedin.com/in/md-h
* Youtube: https://youtube.com/@leomeasure
* Email: info@leomeasure.com
*/
window.addEventListener('message', function(event) {
if(event.origin === 'https://form.typeform.com' && event.data.type === 'form-submit') {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'type_form_submit',
formId: event.data.formId
});
}
});
</script>