Skip to main content

Tally Forms GTM Event Listener

Track Tally form submissions in Google Tag Manager. Fire GA4, Google Ads, and Meta Pixel on tally_form_submit using the Tally.FormSubmitted postMessage event.

tallyformsgtmga4lead-generationno-codeiframe

Event fired

tally_form_submit

Tally Forms

Overview

Tally is a modern, free form builder that embeds via an iframe. It communicates with the parent page using window.postMessage, sending a Tally.FormSubmitted event when a form is successfully completed. This listener intercepts that message and pushes a clean tally_form_submit event to the GTM dataLayer.

Event fired: tally_form_submit Credit: Courtney at Code and Tonic

Why Use This Listener

Tally's iframe architecture prevents GTM's built-in triggers from detecting submissions. This listener bridges the gap using the PostMessage API.

Common Use Cases

  • Track lead form and survey completions as GA4 conversions
  • Fire Google Ads conversion tags on Tally form submission
  • Measure form completion rates across embedded Tally forms
  • Build retargeting audiences from form submitters

Installation

html
<!-- GTM Custom HTML Tag: Tally Forms Listener -->
<script>
var handler = function(e) {
  if (typeof e.data === 'object' && e.data.event === 'Tally.FormSubmitted') {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'event': 'tally_form_submit'
    });
  }
};

if (window.addEventListener) {
  window.addEventListener('message', handler, false);
} else if (window.attachEvent) {
  window.attachEvent('onmessage', handler);
}
</script>

Fire on: DOM Ready. Works in all modern browsers.

Data Layer Output

json
{
  "event": "tally_form_submit"
}

Trigger Configuration

Trigger Type: Custom Event Event Name: tally_form_submit

GA4 Mapping

GA4 EventParameterValue
generate_leadmethod"tally"
generate_leadpage_locationBuilt-in Page URL variable

Debugging

ProblemCauseFix
No event firingTally form on different domainCheck postMessage origin
Multiple firesForm has multiple success screensAdd deduplication logic

Best Practices

  1. Combine the Page URL variable with the trigger to track which page the Tally form is on
  2. If using multiple Tally forms, consider adding form ID from e.data.formId to the push

Extended Version (with Form ID)

javascript
if (e.data.event === 'Tally.FormSubmitted') {
  window.dataLayer.push({
    'event': 'tally_form_submit',
    'tallyFormId': e.data.formId
  });
}

Related Listeners