> ## Documentation Index
> Fetch the complete documentation index at: https://help.maestra.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions After a Form Is Submitted

When a visitor submits a pop-up or embedded form, Maestra can do a lot more than just store the data. You can create or update a customer profile, issue an action, subscribe the visitor to web push, send the event to analytics, or run custom JavaScript. Most forms combine several of these.

You configure post-submission behavior in the form's **What happens after the form is submitted** section.

## Create a new customer

When a new visitor submits the form, Maestra creates a customer profile from the data they entered. Common fields:

* Name
* Email
* Phone
* Gender
* Date of birth
* Subscription preferences (channel and mailing topic)

<Warning>
  At least one contact identifier (email or phone) and at least one subscription must be selected for customer creation to work. Without an identifier, Maestra has no way to recognize the customer in future sessions.
</Warning>

## Edit an existing customer

When the visitor is already known (for example, they're logged in or were identified by a previous form submission), Maestra updates their profile instead of creating a duplicate. You have two update modes:

* **Fill empty fields only.** Maestra adds the submitted values to fields that are currently blank, but does not overwrite existing data. Use this when you don't want to risk replacing accurate customer data with whatever was typed into the form.
* **Update specific fields.** Maestra overwrites the selected fields (such as gender or any public custom field) with the form's values. Use this for fields the customer is explicitly correcting, like updating their birthday or preferred name.

## Issue an action

You can attach a predefined customer action — for example, "Submitted newsletter form" or "Entered giveaway" — whenever the form is completed. The action can carry data values from the form, which become available in flows, segments, and reports.

This is the right tool when:

* You want to trigger a flow off the form submission.
* You want to count submissions in a segment ("customers who entered the giveaway in the last 30 days").
* You want to track form-specific metadata that doesn't belong on the customer profile.

## Subscribe to web push

A form can trigger the browser's native permission request for web push notifications. When the visitor clicks **Allow**, Maestra registers the subscription against their profile and can send web push campaigns to them going forward.

<Tip>
  Don't pair the web push permission with a form that already asks for an email. The double request feels heavy. Use a dedicated, lightweight pop-up whose only job is the push opt-in.
</Tip>

## Send events to analytics

Maestra can transmit form events to your analytics tools so you can track conversions in the same place as the rest of your site metrics:

* **Google Analytics** events
* Other analytics platforms via custom JavaScript

Configure the event name and category in the form settings. The event fires when the form is submitted.

## Run custom JavaScript

For anything the built-in actions don't cover, you can run custom JavaScript at four moments in the form's lifecycle:

* **On render** — when the form is added to the DOM but not yet visible.
* **On display** — when the form becomes visible to the visitor.
* **On submit** — when the visitor submits the form.
* **On close** — when the visitor dismisses the form without submitting.

Typical uses:

* Fire a custom event into a third-party tag manager.
* Apply a promo code to the cart automatically after submission.
* Redirect the visitor to a thank-you page.
* Trigger animations or other on-page changes.

## Data sent with every submission

In addition to the fields the visitor fills in, Maestra automatically attaches contextual data to each submission:

* UTM parameters from the page URL
* Referrer URL
* Visitor geolocation (when available)
* Custom data the form is configured to collect

This data is associated with the customer profile, so it's available later in segments, flows, and reports — for example, you can build a segment of "customers who first subscribed via the `summer-sale` UTM campaign."

<Note>
  The available post-submission actions depend on the form template you chose. Lead-capture templates expose the full set; survey templates may not include web push or customer-creation options because those don't fit the use case.
</Note>
