Skip to main content

DataLayer Events and Payload

Learn everything about DataLayer Events and Payload

In this guide, you'll learn more about Heyflow's Events, which are based on the dataLayer. In particular, we describe here, which tags are fired when and what properties are passed, e.g. when integration with Google Tag Manager.

🔎 If you're new to Google Tag Manager and unfamiliar with the DataLayer, you might want to start here.


Events

The dataLayer is connected to the Heyflow Events API: When an event occurs in the flow, data will be pushed into the dataLayer that the Google Tag Manager can react to.

🔎 Embedded flows: When you embed your flow with the Heyflow embed code (web component), all events are dispatched on the window of your website and pushed to its dataLayer, so you can listen to them directly there. postMessage is not needed. Embedding a flow in an iframe is not supported: the iframe has its own dataLayer and your website does not receive the events. See Track Heyflow events with Google Tag Manager.

🔎 Click here for more information on our DataLayer changelog.

⭐ All dataLayer events are pushed on every plan. The data values fields, fieldsSimple, payload and screens are only filled with the Insights Bundle (included in Scale) or the legacy Business plan. On other plans these values contain the placeholder "upgrade" instead of the answers. Learn more about the payloads in the Heyflow Events API.

Every event Heyflow pushes to the dataLayer also contains FLOW_ID (the ID of the flow). During an A/B test it also contains TEST_ID and VARIANT_ID. If you embed several flows on one page, create a Data Layer Variable for FLOW_ID in GTM and add it to your triggers to tell the flows apart.

The response ID is created only after the response has been saved, so it is not available in the dataLayer or in Events API payloads. If you need a unique ID for tracking (e.g. affiliate networks), generate one with custom JavaScript and store it in a hidden field via the Flow API.

The following events will be considered:

Event name

Payload

heyflow-init

{

fields: [],

screens: {}

}

heyflow-exit

{}

heyflow-change

{

}

heyflow-submit

{

screen_name,

}

heyflow-screen-view

{

screen_id,

screen_name,

previous_screen_id,

previous_screen_name

}

heyflow-screen-leave

{

screen_name,

payload*,

screens**

}

heyflow-button-click

{

custom_event_name,

custom_event_label

}

heyflow-input-click

{

custom_event_name,

custom_event_label

}

ℹ️ In GTM preview you also see the event heyflow-visit. It is pushed once per flow as soon as the flow becomes visible to the visitor (immediately for a standalone flow, on scroll or open for an embedded flow). Heyflow uses it internally as the start of a visit. It is not part of the base container configuration, but you can use it as a trigger.

*) payload

In the heyflows-screen-leave event, a value payload is passed. This value is equal to the fields value but filtered to only include fields that are part of the screen that was left, e.g.

{
...
payload: [
{
id: "slider-2d63fe7a-input",
label: "Value:",
value: "65",
values: [{name: "65", answer: "65"}],
variable: "slider-2d63fe7a",
sensitive: false,
screenID: "screen-7e55219a",
screenName: "screen-81b02c6d"
}
],
...
}

**) screens

In the heyflow-screen-leave event, a value screens is passed. This value is similar to the fields value but structured as an object with the name of the screen as its key, e.g.

{
...
screens: {
screen-580f334a: [
{
id: "o-1e3e4475-option",
label: "Rate your experience:",
value: "3",
values: [{name: "o-1e3e4475", answer: "3"}],
variable: "rating-500e4f20",
sensitive: false,
screenID: "screen-4170032e",
screenName: "screen-580f334a"
}
],
screen-81b02c6d: [
{
id: "slider-2d63fe7a-input",
label: "Value:",
value: "65",
values: [{name: "65", answer: "65"}],
variable: "slider-2d63fe7a",
sensitive: false,
screenID: "screen-7e55219a",
screenName: "screen-81b02c6d"
}
],
screen-dc5933b1: [],
},
...
}
Did this answer your question?