OnSched GTM Event Listener
Track OnSched appointment booking interactions in GTM. Monitor booking steps and confirmed appointments with onsched_action variable.
onschedschedulingappointmentsbookinggtmga4healthcareservices
Event fired
onsched_interactionsKey variable
onsched_actionOnSched
Overview
OnSched is an appointment booking platform used in healthcare, fitness, professional services, and other sectors. This listener tracks the multi-step booking process and confirmed appointments.
Event fired: onsched_interactions
Variable: onsched_action
Tracked Events
| onsched_action | Description |
|---|---|
booking started | Booking flow initiated |
service selected | User picks service type |
provider selected | User picks staff member |
time slot selected | Date/time chosen |
personal info submitted | Contact details entered |
booking confirmed | Appointment booked |
booking cancelled | Cancellation processed |
booking rescheduled | Appointment moved |
Installation
html
<!-- GTM Custom HTML Tag: OnSched Listener -->
<script>
(function() {
function onschedPush(action, extra) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(Object.assign({
'event': 'onsched_interactions',
'onsched_action': action
}, extra || {}));
}
function isOnSchedMessage(e) {
return e.data && e.data.source === 'onsched';
}
window.addEventListener('message', function(e) {
if (!isOnSchedMessage(e)) return;
var data = e.data;
if (data.type === 'serviceSelected') {
onschedPush('service selected', { serviceId: data.serviceId, serviceName: data.serviceName });
} else if (data.type === 'resourceSelected') {
onschedPush('provider selected', { resourceId: data.resourceId });
} else if (data.type === 'timeSelected') {
onschedPush('time slot selected', { selectedTime: data.startDateTime });
} else if (data.type === 'appointmentBooked') {
onschedPush('booking confirmed', {
appointmentId: data.appointmentId,
serviceId: data.serviceId,
appointmentTime: data.startDateTime
});
} else if (data.type === 'appointmentCancelled') {
onschedPush('booking cancelled', { appointmentId: data.appointmentId });
}
});
})();
</script>Data Layer Output
json
{
"event": "onsched_interactions",
"onsched_action": "booking confirmed",
"appointmentId": "appt_abc123",
"serviceId": "service_001",
"appointmentTime": "2024-02-20T09:00:00Z"
}Trigger Configuration
All Events
Trigger Type: Custom Event
Event Name: onsched_interactions
Conversion Only
Condition: DLV – OnSched Action | equals | booking confirmed
GA4 Mapping
| GA4 Event | Trigger | Parameters |
|---|---|---|
book_appointment | booking confirmed | appointment_id, service |
select_content | time slot selected | content_type: "time_slot" |