GTM tags can be added to your campaigns to track and segment users who engage with the experience. Experiences by Jebbit will use postMessage to send the events to the parent page. Sending events via postMessage allows cross-origin communication between Window objects. You'll learn the difference between postMessage-based event tracking and manual GTM configurations, how to pass multiple key/value pairs, and when to involve the Studio team for implementation. This article is especially helpful for brands using embedded formats like iframes, Lightbox, or Companion modes.
GTM benefits
Enhanced tracking capabilities: By integrating GTM post-messaging pixels, you can capture more granular data about user interactions within your Jebbit experience. This includes tracking specific events, such as when users answer questions, engage with content, or reach certain milestones within the experience.
Cross-platform tracking: GTM allows you to consolidate tracking across various platforms and tools. By leveraging GTM, you can ensure that data collected from the Jebbit experience is seamlessly integrated with other analytics platforms, such as Google Analytics. This enables a holistic view of user behavior across different touchpoints.
Customized analytics: With GTM, you have the flexibility to define custom triggers and variables based on your specific tracking requirements. This empowers you to track not only basic metrics but also more nuanced user actions and behaviors within your Jebbit experience. You can track metrics relevant to your business objectives, such as completion rates, drop-off points, or conversion events.
Improved data accuracy: Implementing post-messaging pixels through GTM can help ensure the accuracy and reliability of your tracking data. GTM provides robust error handling and debugging tools, allowing you to troubleshoot tracking issues more effectively and minimize data discrepancies.
Dynamic tag management: GTM offers dynamic tag management capabilities, allowing you to update tracking configurations and deploy new tags without modifying the underlying website code. This agility facilitates rapid iteration and optimization of your tracking setup, ensuring that it remains aligned with evolving business requirements and objectives.
Before you begin
To track custom GTM events in embedded experiences, you should:
Confirm your experience is embedded onsite (e.g., via iframe, Companion, or Lightbox).
If using an embedded experience, enable the 'Send data to parent page' setting in the GTM setup modal to ensure postMessage is activated.
Decide whether your needs can be met with standard postMessage tracking or require Studio support.
Gather your GTM container ID.
Define the events and associated key/value pairs you want to track.
Coordinate with your Customer Success Manager if a Studio request is needed.
Event setup
Experiences by Jebbit uses postMessage to send data from embedded experiences to the parent page, enabling GTM event tracking even across domains.
Using postMessage-based tracking
This setup is self-serve.
Best for standard events (e.g., custom_event, generate_lead).
Define your event name and add key/value pairs in the "Add GTM" step of the Builder.
All data is passed in a single dataLayer.push() call for each screen.
Tip: Clicking Add New Key appends another key/value pair to the same GTM event, not a new one.
Example:
dataLayer.push({'grooming_routine': 'shave prep'});
dataLayer.push({'question_answered': true});
Manual GTM configuration
This setup requires support from the Studio team.
Required for advanced needs like:
Dynamic or conditional event logic.
Custom data structures (e.g., nested keys).
Segmentation tied to button clicks or specific user flows.
Events must be defined in advance and handed off to Jebbit’s Studio team.
The Studio team will implement the logic, test it, and return it for review (usually within 3–5 business days).
Define your events
When defining GTM events in the Builder, you must choose when each event should fire; either on load or on response.
Use on load to track screen views or impressions. These events fire as soon as a screen becomes visible to the user.
Use on response to track user interactions, such as quiz answers, button clicks, or form submissions. This is ideal for custom segmentation and GA4 conversion tracking.
GTM relies on data layer events to pass this information into your GTM container, so choosing the right event type ensures your analytics capture the intended behaviors.
Compare tracking methods
Method | Best for | Setup required |
postMessage | Quick event tracking (e.g., form submissions, completions) | Self-serve via Builder |
Manual GTM | Complex or branded events, dynamic content segmentation | Jebbit Studio implementation |
Attributes vs. GTM keys
Use Case | System | Example |
Profile capture | CRM / Jebbit attributes |
|
Analytics event | GTM dataLayer |
|
Attributes are used to enrich customer profiles and pass data into systems like CRMs or marketing tools.
GTM Events are for behavior tracking, these send user actions into analytics platforms like GA4 via dataLayer.push().
Note: These are separate systems, to include an attribute in a GTM event, you must explicitly configure it as a parameter using a Jebbit Variable.
postMessage overview
If you plan to embed your experience onsite (as an iframe, Companion, or Lightbox), then Jebbit will use postMessage to send the events to the parent page.
postMessage is a method that enables secure communication between pages on different origins.
It allows scripts running in embedded content (such as a Jebbit iframe) to send data to the parent page.
The parent page can then receive this data and use it with analytics or tracking tools, like Google Tag Manager or Google Analytics.
This approach is useful for tracking interactions within embedded content, like quizzes, forms, or videos hosted on a different domain than the main site.
Add a listener on the embedding site
For postMessage tracking to function, the embedding (parent) site must be configured to receive events from the Jebbit iframe. The Jebbit experience will send a postMessage
event to the parent window with the following structure:
data.action = "fireGTM"
data.formData.hash
contains the GTM event data, structured as key/value pairs.
Event listener example
window.addEventListener("message", function(e) {
if (e.data.action === 'fireGTM') {
dataLayer.push({
'event' : e.data.formData.hash
})
}
}, false);
This listener checks for the fireGTM
action and pushes the content of formData.hash
into the Google Tag Manager dataLayer
.
Note: If your embedded Jebbit experience is hosted on a custom domain that shares the same origin (protocol, domain, and port) as the embedding site, the iframe can push events directly to the dataLayer
without needing postMessage
.
Test your GTM setup
To validate your GTM configuration before publishing:
Open the Full Screen Preview link from the Builder.
Interact with the experience until reaching the final screen with mapped events.
Open browser Inspect tools:
Under the Network tab, filter for "gtm-" to confirm the GTM container is loading.
Under the Console tab, type dataLayer and press Enter to view pushed events.
Use Google Tag Assistant to verify pixel firing.
For Lightbox or Companion formats, change the Console dropdown from "top" to the experience ID before inspecting data.
Next steps
For manual setup support, submit a Studio request that includes:
A list of events and expected key/value structure
Your GTM container ID
Confirmation that you're using an embedded experience
FAQ
Is it possible to track more than one event to the same screen?
You can track numerous event key/value pairs for the same questions and responses.
How do I test the events set up with the postMessage implementation?
When you 'Send data to the parent page' we pass data as postMessage events. This means you will need a postMessage listener set up on your website to receive the events properly. You should work with your dev team to test your postMessage implementation.
How long does it take for the Studio Team to implement GTM Events?
Once all the necessary information has been collected, Jebbit Studio Team will implement, test and send over for your review in 3-5 business days. If revisions are needed, that will take an additional 3-5 business days after feedback has been received.