Google Tag Manager (GTM)

Single Google Tag Manager is, in fact, a tag manager, it can be used to load other integrations and analytics tools, such as Intercom, RocketHub, or Google Analytics.

Sending Events to GTM

1. Grab your container ID from GTM

Find your GTM container ID. It will start with "GTM-".
GTM container ID

2. Configure sending events in Formsort

In your Flow's Google Tag Manager Integrations tab, add your container ID. Enable any events you want to receive.
Once container ID is added, events can be enabled
The enabled events options control the events within Formsort that send dataLayer.push variable (stepId, variantLabel, etc).
Note that, as long as a Container ID is provided, GTM will always be loaded, and any of the analytics events you enable will be sent to Google Tag Manager (i.e. FlowLoaded, FlowClosed, etc).
Make sure to:
  • Choose at least FlowLoaded under enabled events
  • Save any changes
The shape of the payload will also be configured and can be seen in "preview event type" at the bottom of the menu. Choosing to Send answers will allow you to push answers to GTM as well.
Append StepID to StepLoaded and StepCompleted event names will add the Step ID to the payload when you receive a StepLoaded and StepCompleted event.
Once you've finished configuring your events, head over to the variants within the flow that you want to pick up the changes. Deploy or re-deploy these variants. Changes to Integrations are not automatically deployed to variants.

3. Configure tags and triggers in GTM

Go back to the container that you created / are using above.
Under Triggers, make a trigger like the following:
Trigger configuration screen in the GTM console
Under Tags, pick a tag. You'll likely want to create some other type of tag to load, but for the purposes of this guide we'll create something simple.
Creating a tag that creates a console alert
Submit the changes at the top right, then Publish.
Click "Submit" at top right
Once "Submit" has been clicked, hit "Publish" at top right

4. Put it together

Visit a live version of your flow. When the flow loads, a console alert will be generated by GTM that shows our tag has successfully loaded.
Console alert script, loaded by GTM

Forwarding Data to Google Analytics: Pageviews

To send pageviews to Google Analytics, via Google Tag Manager, choose the Google Analytics: Universal Analytics tag type, and set Track Type to Page View.
Tag configuration in the GTM console
Note, you probably don't need anything in advanced settings or "Enable overriding settings in this tag" - you just need to create a variable with your GA setup and choose it under Google Analytics Settings.
Under Triggering, choose All Pages.
Once the container is published, you will see Pageviews under Content in GA:
The analytics screen in GA

Forwarding Data to Google Analytics: Events

1. Create the tag

Similar to setting up pageviews, we'll use the Google Analytics: Universal Analytics tag, but in this case, set the Track Type to Event.
Category, Action, and Event will map to the corresponding attributes in Google Analytics - it's up to you what you do with this, but our suggestion is:
  • Set Category to Formsort so that you can distinguish Formsort events from others in your analytics.
  • Set Action to the Custom Events type variable (Name: Event).
Tag configuration in GTM console
  • Set Label to a Data Layer Variable, having it pull the stepId variable from the event payload
Click "+" to open a new variable menu for Label
Choose Data Layer Variable
Give "stepId" as Data Layer Variable Name. Click Save.


stepId, while valuable, is an arbitrary example used for the purposes of this guide. There are several datalayer variables available from Formsort, and in GTM you can configure as many Data Layer Variables are as required for reporting.
The available Data Layer variables can be found in the "Preview Event Type" window of your Google Tag Manager integration console in Formsort.
Different "Event Types" will have different variables available, so be sure to take a moment to look through the options.
Ensure case matching when configuring these variables as Tags.
The datalayer variables available for a UrlOpened Event

2. Set Up the Trigger

In Triggering, create a Custom Event trigger for this tag. To fire it only for a specific event, put the event name in Event name. Alternatively, if you'd like the tag to be triggered on all events, put .* in there and check Use regex matching so that every event gets forwarded along.
Type in .* and check Use regex matching. Trigger fires on All Custom Events.

3. Deploy this container

Once deployed, you should start seeing events flow in. If you set the category when setting up the tag, you should see the step ID come through as the label.
The GA console