Iterate Event Listener

Measure user interaction with Iterate surveys widget on your website and collect data on these interactions as an event data in your analytics platforms like Google Analytics (GA4), Piwik Pro, Matomo, etc. using the Iterate event listener script and Google Tag Manager or other TMS.

How to track Engagements with Iterate survey form with google tag manager

This guide will walk you through the steps of setting up an Iterate event listener within Google Tag Manager (GTM) to track user interactions with the Iterate survey widget on your website. By capturing these interactions, you can send the data to analytics platforms like Google Analytics (GA4), Piwik Pro, or others for deeper insights into user engagement.

Step 1: Add the Iterate Event Listener Script to GTM

To begin, copy the provided Iterate event listener script and add it as a Custom HTML Tag in Google Tag Manager (GTM). Set the tag to fire on the DOM Ready trigger, which ensures that the Iterate widget has loaded before the script starts listening for interactions.

💡 Pro Tip: Always trigger your tag on DOM Ready to prevent any potential issues with the widget loading too late.

The event listener listens for three main user actions within the Iterate widget:

  • Survey Shown
  • Survey Minimized or Closed
  • Survey Response

Whenever one of these events is triggered, it pushes the relevant details to the dataLayer with the event name Iterate_interactions.

Step 2: Create a Custom Event Trigger in GTM

Once the script is added, create a Custom Event Trigger in GTM to listen for the Iterate_interactions event. This will ensure that the correct tags are fired when one of the events occurs.

  1. Go to Triggers in GTM.
  2. Create a new Custom Event Trigger.
  3. Set the event name to Iterate_interactions.

This trigger will activate whenever any of the interactions (survey shown, survey closed, or survey response) occur, allowing you to fire relevant tags.

Step 3: Define DataLayer Variables in GTM

To extract the data from the Iterate_interactions event, you will need to define a set of dataLayer variables. These variables will capture detailed information about the interactions that can be sent to your analytics platform.

Here are the primary variables to define:

  • iterate_action_type: Describes the type of interaction (e.g., shown survey, minimize survey, respond to survey).
  • question: The specific question that the user responded to (only applicable for the onResponse event).
  • response: The answer provided by the user for the question (only applicable for the onResponse event).
  • additionalData: You need to inspect this datalayer object to see the data point you might need, as these are data that may be passed along with the response (e.g., metadata about the question or response type).

These variables will help you track the survey interactions in greater detail and send that data to your analytics platforms.

Step 4: Connecting Your Trigger to Marketing Tags and Pixels

After configuring your triggers and variables, the next step is to set up the appropriate marketing tags to send interaction data to platforms like Google Analytics (GA4) or Piwik Pro.

For instance, to track Iterate interactions in Google Analytics 4 (GA4):

  1. Create a GA4 Event Tag.
  2. Set the Event Name to iterate_hq_interaction.
  3. Configure the Event Parameters to include:
    • iterate_action_type (e.g., shown survey, minimize survey, respond to survey)
    • question (for onResponse events)
    • response (for onResponse events)

This ensures that every time a user interacts with the Iterate survey widget, the data is sent to your analytics platform for tracking and reporting.

The Iterate event listener script is agnostic to any tag management solution, meaning it can be used with platforms other than GTM. The process remains consistent across different TMS systems.

<script>

(function() {

  // Make sure dataLayer exists

  window.dataLayer = window.dataLayer || [];

  // Define IterateHQ event handlers

  if (typeof Iterate === "function") {

    // onLoad event – survey shown

    Iterate('onLoad', function() {

      window.dataLayer.push({

        event: 'iterateHQ_interactions',

        iterate_action_type: 'shown survey'

      });

    });

    // onClose event – survey minimized or closed

    Iterate('onClose', function() {

      window.dataLayer.push({

        event: 'iterateHQ_interactions',

        iterate_action_type: 'minimize survey'

      });

    });

    // onResponse event – user responds to a question

    Iterate('onResponse', function(question, response, additionalData) {

      window.dataLayer.push({

        event: 'iterateHQ_interactions',

        iterate_action_type: 'respond to survey',

        question: question,

        response: response,

        additionalData: additionalData

      });

    });

  }

})();

</script>

Video of how to use the listener

Related Event Listener

Survicate

Easily track if and how users interact with and complete the Survicate survey forms on your website.

Forminator

Use this Forminator event listener to track both successful Forminator form submissions and failures.

SurveyCompo

Track and analyze all user interactions with your SurveyCompo survey forms on your website.

download the google tag manager recipe for tracking Engagements with Iterate survey form

we make you smarter with data

made with ❤️

The DumbData Team
Before you leave, try out these free tools.
FREE GA4 AUDIT TOOL & UTM AUDIT TOOL