RevenueWell embeds certain forms (such as appointment request or online scheduling forms) inside an iframe. Because of this, standard form submission tracking methods do not work.
Instead, RevenueWell sends form submission data from the iframe to the parent page using the browser’s postMessage API. We can listen for these messages and forward them into Google Tag Manager as a custom event.
Once configured, you will be able to:
- Detect when a RevenueWell form is submitted
- Trigger Google Analytics (GA4), Google Ads, or other marketing tags
- Track conversions reliably from RevenueWell-hosted forms
How RevenueWell Sends Form Events
When a user submits a RevenueWell form, the iframe sends a message event to the parent page.
Appointment Request Form Event Structure
The appointment request form sends an event that includes form data:
{
"source": "rw",
"data": {
"name": "Test User",
"phone": "(555) 555-5555",
"email": "test@test.com",
"dates": "Tue, Nov 21, 2023, Any Time",
"reason": "Exam & Cleaning",
"notes": "Test notes"
},
"action": "gaEvent",
"type": "requestAppointment"
}Online Scheduling Request Event Structure
The online scheduling request form sends a simpler event that does not include form field values, but still indicates that a submission occurred:
{
"source": "rw",
"action": "gaEvent",
"type": "onlineSchedulingRequest"
}The key identifier in both cases is:
source === "rw"
High-Level Implementation Steps
To track these events in Google Tag Manager, we will:
- Create a DOM Ready trigger (if one does not already exist)
- Create a Custom HTML tag that listens for RevenueWell iframe messages
- Push a custom event into GTM (
rw-form-submission) - Create a Custom Event trigger in GTM
- Attach that trigger to analytics or advertising tags
Step 1: Create a DOM Ready Trigger
If you already have a DOM Ready trigger available in your GTM container, you can skip this step.
- Open Google Tag Manager
- Navigate to Triggers
- Click New
- Choose Trigger Configuration → DOM Ready
- Select All DOM Ready Events
- Name the trigger (for example:
DOM Ready – All Pages) - Save.
This trigger ensures our custom JavaScript is injected after the page has loaded.
Step 2: Create the Custom HTML Tag
Next, we will create a custom tag that listens for messages coming from the RevenueWell iframe and forwards them into Google Tag Manager.
- Navigate to Tags in Google Tag Manager
- Click New
- Under Tag Configuration, select Custom HTML
- Paste the following code into the HTML field:
<script>
window.addEventListener("message", function (event) {
var submissionEvent = event.data;
// Ensure the message came from RevenueWell
if (submissionEvent && submissionEvent.source === "rw") {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "rw-form-submission",
rwEventType: submissionEvent.type || null,
rwFormData: submissionEvent.data || null
});
}
}, false);
</script>What This Code Does
- Listens for
messageevents on the page - Verifies the message originated from RevenueWell (
source === "rw") - Pushes a custom event named
rw-form-submissioninto the GTM data layer - Optionally exposes:
rwEventType(example:requestAppointment)rwFormData(when available)
Step 3: Attach the DOM Ready Trigger
- In the Triggering section of your Custom HTML tag
- Select the DOM Ready trigger you created earlier
- Save the tag
This ensures the listener is active as soon as the page finishes loading.
Step 4: Create a Custom Event Trigger
Now we will create a trigger that fires when the custom event is pushed into GTM.
- Navigate to Triggers
- Click New
- Choose Trigger Configuration → Custom Event
- Set Event name to: "rw-form-submission"
- Leave the trigger set to All Custom Events.
- Name the trigger (for example:
RW Form Submission) - Save
Step 5: Confirm the Setup Is Working
You can verify the implementation using Google Tag Assistant or GTM Preview mode.
- Enable Preview mode in Google Tag Manager.
- Open your website.
- Submit a RevenueWell form.
- In the Tag Assistant debug panel, confirm:
- A custom event named
rw-form-submissionappears in the event timeline - Any tags attached to the trigger fire as expected
- A custom event named
If you see the custom event, the integration is working correctly.
By completing these steps, you:
- Enable reliable tracking for RevenueWell iframe-based forms.
- Create a reusable GTM trigger that fires on every form submission.
- Give your marketing and analytics tools visibility into RevenueWell conversions.
This setup can be safely shared with third-party vendors and reused across sites that embed RevenueWell forms.