JavaScript triggered by flow events

Run JavaScript via Google Tag Manager

Formsort integrates directly with a number of 3rd party tools. If the tool you need does not have a prebuilt integration, Google Tag Manager can be used to run JavaScript to extend Formsort's capabilities

circle-info

Running JavaScript via Google Tag Manager should only be done as a last resort. Formsort cannot provide support for this functionality or guarantee that it will not negatively impact your flows.

Custom events

Formsort dispatches custom events via custom event apiarrow-up-right. These events can be listened to and used to trigger JavaScript via Google Tag Manager.

The following is a list of events with payload definitions:

  • FlowLoaded

{
	flowLabel: string;
	variantLabel: string;
	deploymentUuid: string;
	experimentId?: string;
	formsortEnv: string; // production, staging etc.
}
  • StepLoaded

{
	stepIndex: number;
	stepId: string | number; // loaded step id, falls back to step index if step id is not given
	// and variant details defined in FlowLoaded
}
  • StepCompleted

  • FlowFinalized

Example function

The following JavaScript for a mock analytics service can be triggered in Google Tag Manager based on a single step of a multi-step flow via the StepLoaded event.

Last updated

Was this helpful?