/** * Panel fields that let an EDITOR configure a form's analytics event — the GTM * `dataLayer` push fired on successful submit — without any code change. Add * them to the Forms collection via the plugin's `formOverrides`: * * ipalKit({ * forms: { * formOverrides: { * fields: ({ defaultFields }) => [...defaultFields, ...buildFormAnalyticsFields()], * }, * }, * }) * * The front reads this config and emits the event automatically via * `formAnalyticsOnSuccess` (see forms.md) — so adding a tracked form, or * changing its event name/params, is panel-only. The GTM side (the Lead/Pixel * tag, its trigger and consent gate) stays in GTM, which is itself a no-code * panel for tags. */ export function buildFormAnalyticsFields() { return [ { name: 'analytics', type: 'group', admin: { description: 'Event pushed to the dataLayer on a successful submit. In GTM, attach a tag (e.g. Lead) with a trigger on this event name.' }, fields: [ { name: 'event', type: 'text', admin: { description: 'Empty = nothing is pushed. Default "form_submit" — attach your GTM trigger to it.' }, defaultValue: 'form_submit', label: 'Event name' }, { name: 'params', type: 'array', admin: { description: 'Key/value pairs sent with the event. A value starting with "$" is taken from a form field, e.g. $topic → the chosen topic.' }, fields: [ { name: 'key', type: 'text', required: true }, { name: 'value', type: 'text', required: true } ], label: 'Event parameters' } ], label: 'Analytics (GTM / dataLayer)' } ]; } //# sourceMappingURL=formAnalyticsFields.js.map