Track scheduling behavior in embedded Calendly forms using custom events.
Calendly loads inside an iframe, which requires additional configuration to track visitor activity. You’ll need to create custom events in Optimize, add JavaScript to your site to capture events from the embedded Calendly form, and contact us to link the events to goals or personalization logic.
Step 1: Create custom events in Optimize
Create a custom event in Optimize for each Calendly event you want to capture. View Calendly's supported events. We recommend starting with these:
| Description | Event |
|---|---|
| Invitee views the event overview page: | calendly.event_type_viewed |
| Invitee selects date and time: | calendly.date_and_time_selected |
| Invitee schedules an event: | calendly.event_scheduled |
To create the custom events:
Create a custom event and enter an API name that matches the Calendly event — e.g., calendlyEventViewed.
Step 2: Add JavaScript to capture Calendly events
Use Calendly’s embed API and Optimize’s sendEvent() API to forward Calendly events to Optimize custom events.
// Assumes 3 custom events are created in Optimize with the API names:
// - calendlyEventViewed
// - calendlyTimeSelected
// - calendlyEventScheduled
function isCalendlyEvent(e) {
return e.data.event && e.data.event.indexOf('calendly') === 0;
};
window.addEventListener(
'message',
function(e) {
if (isCalendlyEvent(e)) {
const event = e.data.event;
if (event === "calendly.event_type_viewed") {
window.intellimize.sendEvent('calendlyEventViewed');
}
if (event === "calendly.date_and_time_selected") {
window.intellimize.sendEvent('calendlyTimeSelected');
}
if (event === "calendly.event_scheduled") {
window.intellimize.sendEvent('calendlyEventScheduled');
}
}
}
);Step 3: Connect the events to goals or personalization
Once your custom events are receiving data, you can:
- Create a custom goal that uses the custom event
- Submit a support request to leverage the events to trigger variations