Track form submissions with the dataLayer

When a visitor successfully submits a Branchside form, the page pushes an event to window.dataLayer. You can use this event in Google Tag Manager (GTM) to trigger your own tags, such as a GA4 event, a Meta Pixel event, or any other tool that reads the data layer.

Every embedded form sends this event, including forms that don't have server-side conversion tracking set up. Branchside writes the event to window.dataLayer, and you decide which tags react to it.

The event contains only two IDs: one for the form and one for the submission. It doesn't include field values, names, email addresses, phone numbers, page URLs, UTM values, or consent state.

When the event fires

The event fires every time a visitor successfully submits the Branchside form.

  • The event fires once for each successful submission.

  • It fires on the page that hosts the form, before the visitor sees the success message or gets redirected.

  • It fires whether or not GTM is installed. Without GTM, the values are still added to window.dataLayer, but no tags run.

The event does not fire when:

  • The form fails validation.

  • The network request fails, or Branchside returns an error.

If your form redirects to a thank-you page, don't trigger tags on that page's view. The event fires on the form page about half a second before the redirect. A page-view trigger on the thank-you page can miss the submission entirely.

Branchside pushes the event regardless of the visitor's consent choices. Your GTM Consent Mode setup controls which tags are allowed to fire.

What the event looks like

On a successful submission, the page pushes two entries to the data layer. The first one clears any values left over from an earlier submission. The second one is the event your tags should listen for.

window.dataLayer = window.dataLayer || [];

// Housekeeping push: clears values from an earlier submission.
window.dataLayer.push({ branchside_data: null });

// The event to trigger your tags on.
window.dataLayer.push({
    event: 'branchside_form_submission',
    branchside_data: {
        form_id: '<form UUID>',
        event_id: '<submission UUID>',
    },
});
Key What it means
event Always branchside_form_submission. Use this exact value in a GTM Custom Event trigger.
branchside_data.form_id The ID of the form that was submitted. Use it to tell apart several forms on the same site. You can find it in the form's embed code (data-formid) or in your dashboard.
branchside_data.event_id A unique ID for this submission. If a platform supports deduplication, you can use this ID as the deduplication key.

The first push isn't an event, so it can't start a Custom Event trigger. Its only job is to stop a tag from reusing the previous submission's values. Outside the event itself, branchside_data can be null. That's normal.

Set up the event in Google Tag Manager

Step 1: Create a Custom Event trigger

  1. In GTM, open Triggers and click New.

  2. Choose Custom Event as the trigger type.

  3. Enter branchside_form_submission as the Event name. It has to match exactly, including the underscores.

  4. Save the trigger. A clear name, such as "Branchside — form submission trigger", makes it easier to find later.

Track one form only

If several forms share a page, the event fires for all of them. To track just one, add a condition to the Custom Event trigger:

  • Choose Some Custom Events.

  • Add a condition where branchside_data.form_id equals the form ID you want to track.

If different forms need different tags or parameters, create one trigger per form.

Step 2: Create Data Layer Variables

  1. Open Variables and click New.

  2. Choose Data Layer Variable as the variable type.

  3. Enter branchside_data.form_id as the Data Layer Variable Name.

  4. Leave Data Layer Version set to the default, Version 2, and save the variable.

  5. Repeat these steps for branchside_data.event_id.

Step 3: Attach the trigger and variables to a tag

Create or edit the tag that should receive the event, then:

  1. Set the tag's trigger to the Branchside — form submission trigger Custom Event trigger from Step 1.

  2. Add the Data Layer Variables wherever the tag accepts dynamic values, such as event parameters, custom properties, or an event ID field.

  3. Save the tag and publish your container.

Step 4: Test the setup

  1. Click Preview in GTM and open the page that hosts your form.

  2. Submit a test entry. On the success step, check that branchside_form_submission appears in GTM Preview and that your tag fires with it.

  3. Open the browser's developer console and run window.dataLayer. You should see both pushes.

  4. If you're using a test form, submit it a second time. Each submission should produce a new event_id.

Examples

Send a GA4 event with the form ID

Create a GA4 Event tag that fires on the branchside_form_submission trigger.

  • Use an event name that fits your measurement plan, such as generate_lead.

  • Add form_id as an event parameter with the value {{DLV - branchside_data.form_id}}.

Send a Meta Pixel event

Create a Meta Pixel tag that uses the Custom Event trigger.

  • Choose the Meta event you want to send, such as Lead, or enter a custom event name.

  • If the tag has an event ID field, set it to {{DLV - branchside_data.event_id}}.

  • If you need to separate forms in Meta reporting, pass form_id as a custom property.

  • If you want to keep the submission ID for reporting or deduplication, add event_id as an event parameter too.

Troubleshooting

No event appears after submitting the form

The submission wasn't accepted. Check that all required fields pass validation, that the form is published, and that the visitor's browser can reach Branchside. Validation errors, network errors, and server errors don't push the event.

The event shows up in window.dataLayer, but no tag fires

The page might not have a GTM container, or the container might be blocked by an ad blocker, a content security policy, or a consent tool. Confirm that GTM loads on the page, and that your trigger uses the exact event name branchside_form_submission.

A tag waits for the next page

The event fires before the form redirects, so a tag that waits for a page view can miss it. Use the Custom Event trigger only, and make sure the tag doesn't have an extra page-view condition.

branchside_data shows null

The null value comes from the housekeeping push that runs before the event, so it's expected outside the event. If a Data Layer Variable shows null during a submission, check that it uses the full path (branchside_data.form_id or branchside_data.event_id) and that it's set to Data Layer Version 2.

Several forms share a page

Use branchside_data.form_id to tell them apart. The event name is the same for every form.