Skip to main content

How do I track conversion events from my embedded forms?

As an admin, learn how to receive tracking events from Optix embedded forms so you can forward conversions to Google Analytics or any other analytics system.

Written by Raul Zhou

Note: This feature requires adding JavaScript to your website. If you are not comfortable with code, we recommend involving a developer.

Optix embedded forms can send tracking events to your website as visitors move through them. Because the forms run inside an iframe, they use window.postMessage to pass events to your page — so you can forward them to Google Analytics, your CRM, or any analytics system you already use.

Tracking events works across all four Optix forms: drop-in bookings, tour bookings, sign-up, and inquiry.


Tracking events helps you:

  • Measure conversions accurately: Know when a visitor completes a booking, joins a plan, books a tour, or submits an inquiry - without relying on page redirects.

  • Connect campaigns to outcomes: Pair Optix events with your own UTM parameters or referrer data to see which channels are driving memberships and bookings.

  • Send data anywhere: Forward events to Google Analytics, a tag manager, your CRM, or any pipeline your team already uses.


How to enable tracking


Tracking events are off by default, so existing embeds are unaffected. Add ?tracking=1 to the form URL in your iframe to turn them on:

<iframe src="https://your-space.optixapp.com/signup/?tracking=1"></iframe>

By default, messages are sent to any parent origin (*). To restrict delivery to your site only — recommended when events carry personal data like email addresses — also pass your origin:

<iframe src="https://your-space.optixapp.com/signup/?tracking=1&tracking_origin=https://your-website.com"></iframe>

Note: Why is tracking opt-in? Conversion events carry personal data (email, name). Keeping tracking opt-in means this data only flows where it is expected. It also avoids conflicts with other scripts on your page that listen for window messages.

How to listen for events on your page

Add a message event listener to your page. Always check e.data.source === "optix-form" first — your page may receive messages from many sources.

window.addEventListener("message", (e) => {   if (!e.data || e.data.source !== "optix-form") return;  // Forward to Google Analytics (gtag.js)   gtag("event", e.data.event, { form: e.data.form, ...e.data.payload });  // ...or merge with your UTM/source data and send anywhere });

How to set the message format

Every event posted to the parent window has this shape:

{   source: "optix-form",   form: "booking" | "tour" | "signup" | "inquiry",   event: "page_view" | "booking_confirmed" | ...,   payload: { ... },   ts: 1718000000000 }

  • source — Always "optix-form". Use this to filter out unrelated messages.

  • form — Which form fired the event: "booking", "tour", "signup", or "inquiry".

  • event — The event name. See the table below.

  • payload — Event-specific fields. See the table below.

  • ts — Emit time in milliseconds. Useful for de-duplicating messages.

What are the supported events

Event

Form(s)

When it fires

Payload fields

form_ready

All

The form has loaded

(none)

page_view

All

On every step / route change

name, path

booking_checkout

Booking

Visitor reaches the sign-in step

resource_id, resource_name, location_id, location_name, start_timestamp, end_timestamp, subtotal, total

booking_confirmed

Booking

A booking is confirmed

user_email, booking_id, resource_id, resource_name, location_id, location_name, start_timestamp, end_timestamp, subtotal, total

tour_confirmed

Tour

A tour is booked

user_email, tour_id, location_id, location_name, start_timestamp, end_timestamp

signup_checkout

Sign-up

Visitor reaches the payment step

user_email, plan_name, pass_name, plan_start_timestamp, plan_duration_months, total

signup_completed

Sign-up

A sign-up is completed

user_email, plan_name, pass_name, plan_start_timestamp, plan_duration_months, total

inquiry_submitted

Inquiry

An inquiry is submitted

user_email, plan_name, pass_name, custom_inquiry

Note: start_timestamp and end_timestamp are Unix timestamps in seconds. Some payload fields are omitted when not yet available — for example, booking_checkout does not include user_email because the visitor has not signed in yet. The subtotal and total on booking_checkout are estimates from the payment preview; booking_confirmed carries the final confirmed amounts.

FAQs

Can I track UTM parameters or referral sources through Optix events?

You can read the UTM parameters or referrer data from your own page URL and attach them to the event before forwarding it to your analytics system. Optix events tell you what happened (a booking, a sign-up, a tour); your page gives you where the visitor came from. Combine the two on your end to get full attribution.

Does adding ?tracking=1 affect existing embeds?

No. Tracking events is off by default. Only iframes that include ?tracking=1 in the URL will send events. Any existing embeds without this parameter are unaffected.

Which forms support tracking events?

All four Optix embeddable forms support tracking events: drop-in bookings, tour bookings, sign-up, and inquiry.

What is tracking_origin, and should I use it?

With the default *The browser delivers each event to whatever origin occupies the parent frame, including if your page is itself embedded somewhere else. Setting tracking_origin to your exact site (e.g. tracking_origin=https://your-website.com) ensures personal data in conversion events is only ever delivered to your page. Use it whenever events carry user data, which they do for any conversion event.

What is the ts field for?

The ts field records the emit time in milliseconds. You can use it to de-duplicate events on your end if needed.


Need more info on Forms?

Did this answer your question?